Passing javascript variable to JSP via AJAX -


i need pass javascript variable "textval" jsp.i can't figure correct syntax. code this

 function show(textval){    ajax.onreadystatechange = handler;    ajax.open("post","service.jsp",true);    ajax.setrequestheader("content-type","application/x-www-form-urlencoded");    ajax.send("fname='+textval+'"); }; 

how pass textval service.jsp

you not need quotes. can use:

ajax.send("fname="+encodeuricomponent(textval)); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -