473,395 Members | 1,968 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,395 software developers and data experts.

retrive values from another PHP page using AJAX

vijcbe
16
Hello friends!!
My program goes like this..
I have a page where user id and password are entered.
When they click submit button(input type is not submit), it goes to Javascript and sends AJAX request for another PHP page and checks whether those userid and password exists are not.

Javascript coding:

Expand|Select|Wrap|Line Numbers
  1. var url="abc.php";
  2. url=url+"?id="+str.username.value;
  3. url=url+"&pass="+str.password.value;
  4. url=url+"&sid="+Math.random();
  5. xmlHttp.onreadystatechange=stateChanged;
  6. xmlHttp.open("GET",url,true);
  7. xmlHttp.send(null);
  8.  
  9. document.forms[0].submit();
  10.  
Everything works perfect and I am getting the AJAX functions delivered on my main page. Since, i am submitting the form, it goes to the next page. Is there is any method available, so that, I can check whether the userid and password and submit the form only if the userid and password or correct. For example in gmail, if you give wrong id or password it will give an error message on the same page and gets submitted only when userid and password are correct.

Anyone please give me a fix for this issue.
Thanks a million in advance.
VJ
Oct 24 '07 #1
5 1646
acoder
16,027 Expert Mod 8TB
Put the submit in your stateChanged function. If the validation passes, submit the form, otherwise display the error message.
Oct 24 '07 #2
vijcbe
16
Please tell me how to check for the condition in stateChanged function.
thanks,
VJ
Oct 24 '07 #3
acoder
16,027 Expert Mod 8TB
That depends on what the PHP page returns when the validation passes/fails.
Oct 24 '07 #4
vijcbe
16
Thank You Pal.. It works perfectly..
Again Thanks a million..
VJ
Oct 24 '07 #5
acoder
16,027 Expert Mod 8TB
Again Thanks a million..
That's two million now :)

Glad to hear that you got it working.
Oct 24 '07 #6

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

Similar topics

4
by: d3vkit | last post by:
I have a form on my page, and some javascript which uses ajax to submit the form, and then opens the new page in a div using ajax so there is no refresh. This works fine. But the problem is this: all...
2
by: gahoi | last post by:
all off you hru we need to help for one problum create to me in database i am develop the login page and we save the user name, password and email address in table and we have retrive the...
2
by: sujathaL | last post by:
Here,i am getting the table from another page by using ajax.i want to get values which are in the table.how to get those values using javascript.
1
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
2
by: =?Utf-8?B?TG91aXNhOTk=?= | last post by:
Hello. ive just read some posts on the age old issue of losing dynamic control values on postback. Most people say recreate the controls on the onInit, but i just dont think this serves my purpose....
1
by: ganesh22 | last post by:
Hi, Here the below code is for dynamically creating textboxs, its creating fine but after user enters some values in textboxs how can i retrive that values? using System; using System.Data;...
1
paulrajj
by: paulrajj | last post by:
hi all, i am using php with ajax to load a page. i am using a page that contains ajax to access another page in same file. In the ajax calling page i am having form to post the values and...
4
paulrajj
by: paulrajj | last post by:
hi all, i am using php with ajax to load a page. i am using a page that contains ajax to access another page in same file. In the ajax calling page i am having form to post the values and stored...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.