File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Problem with the ajax app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with the ajax app" Watch "Problem with the ajax app" New topic
Author

Problem with the ajax app

Varun Nayudu
Ranch Hand

Joined: Jun 26, 2006
Posts: 157
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: 15376
    
    6
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: 157
Eric Pascarello wrote: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


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: 15376
    
    6
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: 157
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: 157
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with the ajax app