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

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -