servlets - query reg the url used in post method of ajax call -
servlets - query reg the url used in post method of ajax call -
i new ajax, help me know excatly value used in url in post method. have read on net should point file on server. have ajax phone call in 1 index.html. in server have servlet (s) , web.xml.
i used below ajax call:
localhostif (resp!=null){ log('resp not null '); ajaxpost(resp); } function ajaxpost(data) { log('after entering ajax function '); var httprequest = false; if (window.xmlhttprequest) { httprequest = new xmlhttprequest(); } else if (window.activexobject) { httprequest = new activexobject("microsoft.xmlhttp"); } log('xmlhttpreq obj created '); httprequest.open("post", "http://localhost:8083/ps" , true); httprequest.setrequestheader('content-type', 'application/x-www-form- urlencoded'); httprequest.onreadystatechange = function() { if (httprequest.readystate === 4) { if (httprequest.status !== 200) { log('remote logging failed. url: '); } } } httprequest.send("msg="+data); log('remote logging not failed. url: '); };
and web.xml :
<?xml version="1.0" encoding="iso-8859-1" ?> <web-app> <display-name>helloworld application</display-name> <description> simple web application source code organization based on recommendations of application developer's guide. </description> <servlet> <servlet-name>servletstoringrespstates</servlet-name> <servlet-class>servpackage.servletstoringrespstates</servlet-class> </servlet> <servlet-mapping> <servlet-name>servletstoringrespstates</servlet-name> <url-pattern>/ps</url-pattern> </servlet-mapping> </web-app>
ajax servlets
Comments
Post a Comment