I am trying to do a simple call to a servlet in ajax :
$.ajax({
type: 'GET',
url: 'http://myserver/c/myfunction',
cache : false,
data: {key: 'value'},
success:function(){
alert("success");
},
error:function(){
alert("error");
}
});
with my servlet function in java :
@RequestMapping(value = "/c/myfunction", method = {RequestMethod.GET})
public synchronized void myfunction(HttpServletRequest request, HttpServletResponse response) {
response.setStatus(HttpServletResponse.SC_OK);
}
I get a status code 200 OK, but I still see the "error" alert. Any suggestion?