ajax打印错误json,jquery ajax无法获取回调json,并且报告错误

各种百度说这个错误是因为json格式不标注引起的

这是后端php 用json_encode函数生成的json

e38d38bffc38375e5c7f3d42223e1c39.png

看了jquery的官方文档似乎没错

jQuery.parseJSON( json )

Passing in a malformed JSON string will result in an exception being thrown. For example, the following are all malformed JSON strings:

{test: 1} (test does not have double quotes around it). 译:test两边必须有双引号 {"test":1}

{'test': 1} ('test' is using single quotes instead of double quotes). 译:test两边的引号不能为单引号,一定要是双引号

Additionally if you pass in nothing, an empty string, null, or undefined, 'null' will be returned from parseJSON. Where the browser provides a native implementation of JSON.parse, jQuery uses it to parse the string. For details on the JSON format, see http://json.org/.

而且以前一直都是这么返回的都没有出错,请问那么正确的json标准格式应该是怎样的?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值