【发布时间】:2016-08-15 21:05:21
【问题描述】:
这是我的 ajax 调用:
$.ajax({
url: 'configuration/activePlatform/',
type: 'GET',
dataType: 'json',
contentType: "application/json",
success: function(data){
console.log("getActivePlatform ACK");
$('#activePlatform').append(data);
},
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
}
});
此调用的响应是 200 OK。
我得到一个明文作为响应,错误消息是“Unexpected token s”
这是我的服务器端代码:
@Controller
@RequestMapping("/configuration")
public class configuration {
@Autowired
public CommonConfigurations configurations;
@RequestMapping(value = "/activePlatform", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON)
public @ResponseBody
String activePlatform() throws Exception {
return configurations.activePlatform;
}
}
我做错了什么?
【问题讨论】:
标签: java jquery json ajax spring