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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -