I'm doing what seems to be an extremely simple ajax call to my Spring controller. It hits the controller fine, and that println gets printed, but I never get inside the AJAX success function. Any ideas?
My AJAX call:
$.post(SERVER_LOC, function(){
alert("success!");
});
My Spring controller:
@RequestMapping(value = "/", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
public void home(String s) {
System.out.println("In the controller!");
}
Alright I figured it out. This code is correct. The problem was I was trying to make this request across domains from a different project. Apparently I cannot receive a request back from the server cross-domain when I do this. I moved everything to one project and it works fine.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句