| Author |
Problem with the ajax app
|
Varun Nayudu
Ranch Hand
Joined: Jun 26, 2006
Posts: 156
|
|
I am trying to build a small app in which there is a text box and when a user inputs any value in the text box , after the value is put in it the ajax code should check with the server whether there is any data in the database with that same value .If there is then a small message should appear at the side of the text box stating that the value is not available
the code is as follows
bean code
the page which needs to be displayed next to the text box
but here is the problem when ever i put the value in the text box i am getting the same message as available .....even if i put the value from the textbox
|
SCJP 1.5, SCWCD 1.5
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
in JavaScript you should never use "with". http://www.yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/
Do you see a problem here? xmlHttp.open("GET","serv.do",false);
I do.
Eric
|
 |
Varun Nayudu
Ranch Hand
Joined: Jun 26, 2006
Posts: 156
|
|
Eric could you please tell me what is the problem with the code which you have mentioned above ..
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You are not sending up any form data to the server. The XMLHttpRequest object does not send up form fields like a normal form submission does.
Ajax 101
Eric
|
 |
Varun Nayudu
Ranch Hand
Joined: Jun 26, 2006
Posts: 156
|
|
Eric Pascarello wrote:You are not sending up any form data to the server. The XMLHttpRequest object does not send up form fields like a normal form submission does.
Ajax 101
Eric
So what should the code be . I though with ajax you could send the field to the server . What should i do then?
|
 |
Varun Nayudu
Ranch Hand
Joined: Jun 26, 2006
Posts: 156
|
|
Varun Nayudu wrote:
Eric Pascarello wrote:You are not sending up any form data to the server. The XMLHttpRequest object does not send up form fields like a normal form submission does.
Ajax 101
Eric
So what should the code be . I though with ajax you could send the field to the server . What should i do then?
I was able to rectify it .Thanks eric for the info
xmlHttp.open("GET","serv.do?username="+username.value,false);
now its working fine
|
 |
 |
|
|
subject: Problem with the ajax app
|
|
|