473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

how to load o/p of php in current page using js?

hi i am new to web development and i am using js/ajax code to load o/p of php file in <div> tag. Now i am using a login.php file and i want that if login credentials are correct then further page should be open in current window else login fail message should be displayed below the username and password text box. following is the code i am using -
Expand|Select|Wrap|Line Numbers
  1. function updateLink(id,pwd){
  2.     var oRequest;
  3.     try {
  4.         oRequest=new XMLHttpRequest();
  5.     } catch (e)   {
  6.         try {
  7.             oRequest=new ActiveXObject("Msxml2.XMLHTTP");
  8.         } catch (e) {
  9.             try {
  10.                 oRequest=new ActiveXObject("Microsoft.XMLHTTP");
  11.             } catch (e) {
  12.                 alert("Your browser does not support AJAX!");
  13.                 return false;
  14.             }
  15.         }
  16.     }
  17.     oRequest.onreadystatechange=function() {
  18.         if(oRequest.readyState==4)
  19.         {
  20.             var div = window.parent.document.getElementById('result');
  21.             div.innerHTML = oRequest.responseText;
  22.         }
  23.     }
  24.     var url = "updateLinks.php";
  25.     url = url+"?id="+id;
  26.     url = url+"&pass="+pwd
  27.     oRequest.open("GET",url,true);
  28.     oRequest.send(null);
  29. }
  30.  
how can i modify the above code to do above written task?
Feb 24 '10 #1

✓ answered by Dormilich

I would use a plain form for that and let PHP decide what page to load. works even with JavaScript disabled.

1 1508
Dormilich
8,658 Expert Mod 8TB
I would use a plain form for that and let PHP decide what page to load. works even with JavaScript disabled.
Feb 24 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
3
by: StephenRichter | last post by:
I have installed the trial of db2 enterprise server on my w2k PC. Have also installed fix pack 8 of that product. I am using it to connect from an asp.net web page to an IBM as400. the 400 is...
4
by: Brett | last post by:
Say I open an IE window and call the Navigate() method. A web page opens. I use a delegate to capture the DocumentComplete and NavigateComplete2 events. However, they fire slightly before the...
9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
7
by: Goober | last post by:
I have a page that receives a session variable from the default.aspx. On Page load, the code in Page load gets executed twice. So far, no problem. It sets the session variable each time,...
1
by: Andy | last post by:
Hey all, I just started working with .net 2.0 master pages. What is the best way to calculate page load times using master pages and user controls? I'm not sure the order of execution and where to...
4
by: Richard Bysouth | last post by:
Hi I am running a site built on asp.net 1.1 on a windows server 2003 (which is running asp.net 2.0 - shared hosting at my webhost). The site is low traffic and very simple (mostly static text...
2
by: justsome_newbie | last post by:
This has to be simple, but I can't seem to grasp what I'm doing wrong! I have a user control that contains a button that when clicked raises a "AddEvent". When this fires I want the host page to...
6
by: dean.h.brown | last post by:
How do you get the Calendar date when the page first loads? I have this code (which works once the user selects a date) - I get "12:00:00 AM" for the label.text when the page first loads: ...
2
by: pankajsingh5k | last post by:
Dear All, Please help me... I had read an article to lazy load a tab in a tabcontainer using an update panel on http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.