简体   繁体   English

JavaScript运行时错误:无效字符(JSON.parse)

[英]JavaScript runtime error: Invalid character (JSON.parse)

My sender function: 我的寄件人功能:

var parseData = JSON.stringify(requestData);
        iframe[0].contentWindow.postMessage({ request: parseData, request_id: dataOrign.length - 1 }, '*');

and function of receiving a request: 和接收请求的功能:

$(window).on("message", function(e) {
        var requestData = JSON.parse(e.originalEvent.data.request);
    }

in IE 9 I have this error: 在IE 9中我有这个错误:

0x800a03f6 - JavaScript runtime error: Invalid character in: 0x800a03f6 - JavaScript运行时错误:以下字符无效:

var requestData = JSON.parse(e.originalEvent.data.request);

In other browsers everything works fine. 在其他浏览器中一切正常。 tell me what the problem is and how to solve it? 告诉我问题是什么以及如何解决?

Are you using IIS? 你在使用IIS吗? If so, open IIS and look at your MIME types. 如果是这样,请打开IIS并查看您的MIME类型。 Check to see if you have one called .json. 检查你是否有一个名为.json的。 If not, simply add one called .json and set it to application/json. 如果没有,只需添加一个名为.json的文件并将其设置为application / json。

Hope it helps :) 希望能帮助到你 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM