ajax接收json 返回数据在error里面

前端控制台信息:
  1. status:200
  2. statusCode:ƒ (e)
  3. statusText:"OK"
  4. 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就可以

猜你喜欢

转载自blog.csdn.net/qq_28524127/article/details/80776215