当我从服务器获取一些无法解析的数据时,尝试块死在IE8中杀死页面
var statusData='';
try
{
statusData = $.parseJSON(responseText);
}
catch(e)
{
statusData = $.parseJSON( '[message=>"Some error occured",Status=>false]');
}
答案 0 :(得分:0)
var jsonData = {
"objects" : [
{
"type" : "image",
"left" : 167,
"top" : 97,
"width" : 480,
"height" : 240,
"id" : "DIN8DIF1",
"userId" : "ITNTMB1B",
"userName" : "Developer 1",
"createTime" : "2016-01-08 14:45:28",
"lastModify" : "2016-01-08 14:45:28",
"src" : "data:video/mp4;base64,//data url
"filters" : [],
"crossOrigin" : ""
},
],
"background" : "#ffffff",
"width" : 750,
"height" : 530
}
canvas.loadFromJSON(jsonData);
中的代码可以替换为我假设的代码
catch
您有一个PHP序列化数组来代替JSON字符串,这就是您收到该错误的原因。