您的位置:首页 > Web前端 > JQuery

[jquery] ajax parsererror

2015-07-06 18:30 585 查看
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()函数  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: