码迷,mamicode.com
首页 > Web开发 > 详细

[jquery] ajax parsererror

时间:2015-07-06 19:34:41      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

http://stackoverflow.com/questions/5061310/jquery-returning-parsererror-for-ajax-request

方法一:

直接去掉 dataType : ‘json‘ 属性

方法二:

The reason why this parserror message occurs is that when you simply return a string or another value, it is not really Json, so the parser fails when parsing it.

意思是说,如果你返回的不是真正的json格式的数据,那么就会提示parsererror。

因此,解决办法就很简单了,把返回的结果转换成Json格式就好了。比如php就可以使用 json_encode()函数  

[jquery] ajax parsererror

标签:

原文地址:http://www.cnblogs.com/bushe/p/4625070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!