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
Post a Comment