AJAX call to Spring MVC works, but doesn't hit success function

cgsd

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!");
}
cgsd

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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

MVC-AJAX iterate <div> for no data in ajax success has

来自分类Dev

jquery ajax call works on localhost, but not on live server

来自分类Dev

Spring MVC Ajax表单提交

来自分类Dev

Spring MVC处理AJAX请求

来自分类Dev

Spring MVC Ajax开机自检

来自分类Dev

Spring MVC Ajax表单提交

来自分类Dev

Spring MVC + Ajax JSON发布

来自分类Dev

Spring MVC + Ajax错误400

来自分类Dev

如何在AJAX中用.done()替换success:function()

来自分类Dev

How to parse following json in jquery ajax success function

来自分类Dev

FCGI_SetExitStatus doesn't works

来自分类Dev

Append div using Ajax call works only in the first load

来自分类Dev

Spring MVC Ajax 400错误请求

来自分类Dev

AJAX在Spring MVC中返回404

来自分类Dev

Spring MVC 3.2 Thymeleaf Ajax片段

来自分类Dev

Ajax使用Spring MVC获取请求

来自分类Dev

Spring MVC Ajax文件上传错误

来自分类Dev

Spring MVC 400错误请求Ajax

来自分类Dev

Ajax调用Spring MVC Controler错误的请求

来自分类Dev

用ajax和spring mvc更新表

来自分类Dev

Spring MVC AJAX错误请求错误

来自分类Dev

从Ajax到Spring MVC的请求。404错误

来自分类Dev

Ajax调用Spring MVC Controler错误的请求

来自分类Dev

Spring MVC在Ajax中出现BadRequest错误

来自分类Dev

Spring MVC 中的 Ajax 发布请求

来自分类Dev

对象错误-通过 Spring MVC 调用 Ajax

来自分类Dev

Jquery - Multiple function calls to one AJAX call

来自分类Dev

UICollectionView selectItemAtIndexPath doesn't call didSelectItemAtIndexPath

来自分类Dev

How to call another function after complete bserverside ajax function