Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with the ajax app

 
Varun Nayudu
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic