Chrome发送请求错误:TypeError:将循环结构转换为JSON我有以下.。chrome.extension.sendRequest({
req: "getDocument",
docu: pagedoc,
name: 'name'}, function(response){
var efjs = response.reply;});这就叫.。case "getBrowserForDocumentAttribute":
alert("ZOMG HERE");
sendResponse({
reply: getBrowserForDocumentAttribute(request.docu,request.name)
});
break;但是,我的代码从未到达“ZOMG这里”,而是在运行时抛出以下错误chrome.extension.sendRequest Uncaught TypeError: Converting circular structure to JSON
chromeHidden.JSON.stringify
chrome.Port.postMessage
chrome.initExtension.chrome.extension.sendRequest
suggestQuery有人知道是什么原因造成的吗?
3 回答
开满天机
TA贡献1786条经验 获得超13个赞
pagedoc
var a = {};a.b = a;JSON.stringify
N.B.ownerDocumentdocumentdocumentdocument.bodydocument.body.ownerDocumentdocument
Helenr
TA贡献1780条经验 获得超4个赞
function simpleStringify (object){
var simpleObject = {};
for (var prop in object ){
if (!object.hasOwnProperty(prop)){
continue;
}
if (typeof(object[prop]) == 'object'){
continue;
}
if (typeof(object[prop]) == 'function'){
continue;
}
simpleObject[prop] = object[prop];
}
return JSON.stringify(simpleObject); // returns cleaned up JSON};添加回答
举报
0/150
提交
取消
