jQuery Servlet call returns error -
i make simplest jquery servlet call:
jquery:
$.ajax( "loginservlet" ) .done(function() { alert("success"); }) .fail(function() { alert("error"); });
servlet:
protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { system.out.println("posting"); }
on console, see posting
, servlet called. however, still 'error' alert.
somewhere else, mentioned possible 'cross site scripting' problem. problem?
my servlet at: localhost:8080/test/loginservlet
when request servlet nothing print in console, must manage response of cycle request/response.
so try following:
// obtain out writer stream response // object send response client (the web page) printwriter out = response.getwriter(); // print response of request posting out.println("posting"); // close out stream out.close();
now jquery request response.
Comments
Post a Comment