ajax jumps to the background and cannot return to the view. What is returned is a whole json array
The methods written before can be used, but I don’t know why it is wrong this time, and the console does not output a new error message.
ajax:
$.ajax({
type : "post",
url : "Qtitle/findTypeTitle3",
dataType : "json",
data : {"tite" : it},
success : function(data) {
alert(11111); //能弹出
}
});
It stands to reason that it works, data has data, alert() is also triggered, but I don’t know why it still jumps to a page that outputs a json array
世界只因有你2017-06-23 09:14:24
The Controller’s method returns JSON data, but @ResponseBody is not added to the method, so the returned JSON data jumps to another page.
曾经蜡笔没有小新2017-06-23 09:14:24
It is possible that the correct json format is not returned
The returned data has other code formats
迷茫2017-06-23 09:14:24
Have you added the @ResponseBody annotation? This annotation will convert the return value into json format
//跳转到jsp页面
@RequestMapping("jspViewTest")
public String jspViewTest() {
return "index";
}
//返回数据对象
@RequestMapping("dataTest")
@ResponseBody
public String dataTest() {
return "index";
}