且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery.ajax()调用返回JSON.parse意外字符错误

更新时间:2021-09-21 22:33:19

将内容的标头设置为json类型... 这是设置标题类型的示例.

Set the header of the content to type of json... Here is an example of setting header type.

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');

从jQuery 1.4开始,严格按照JSON数据进行解析.

In jQuery 1.4 onwards the JSON data is parsed in a strict manner.

任何格式错误的JSON都会被拒绝,并引发解析错误.

Any malformed JSON is rejected and a parse error is thrown.