当前位置: 动力学知识库 > 问答 > 编程问答 >

SpringMVC, Jquery, ajax post rises error function

问题描述:

I don't know why the call to the Controller rises the error Ajax Jquery function. The controller function is executed successfully and return "OK". And the "e" parameter of the error function is undefined.

I have this code

Controller code - SpringMVC

@RequestMapping(value = "/updateItem/", method = RequestMethod.POST)

public String updateItem(Model model, HttpServletRequest request,

@RequestParam("id") String id, ...) {

//Operations

return "OK";

}

Jquery code

 function updateItem() {

$.ajax({

url : "/.../updateItem/",

type : 'POST',

async : false,

data : {

id : id.value,

...

},

success: function(response) { alert("second success"); },

error: function(e) { alert("error " + e);},

complete: function() { alert("complete"); },

});

}

}

网友答案:

Open up chrome, press f12 to open up the dev tools, look at console / network

what is the error from post you are getting in both tabs?

Your code looks alright btw.

分享给朋友:
您可能感兴趣的文章:
随机阅读: