ajax接收json 返回数据在error里面
前端控制台信息:
- status:200
- statusCode:ƒ (e)
- statusText:"OK"
- jsp页面请求:
已经成功接收到信息了,但是返回的数据时在error里面.
后台也没问题,此方法模拟数据:
@RequestMapping(value = "phone/home/find",method=RequestMethod.POST)
@ResponseBody
public Object find(HttpServletRequest request, HttpServletResponse response)
throws IOException, ApplicationException {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "0");
return gson.toJson(map);
}
此问题原因在于数据类型不对,把dataType改为 text就可以