gpt4 book ai didi

javascript - JSON 在 IE 中不起作用

转载 作者:行者123 更新时间:2023-11-30 13:14:15 26 4
gpt4 key购买 nike

<分区>

这是我用来从 PHP 获取 JSON 响应的代码:

(function() {

var bar = $('.bar');
var percent = $('.percent');
var status = $('#status');

$('#image-upload-form').ajaxForm({
dataType: null,
beforeSend: function() {
status.empty();
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
//console.log(percentVal, position, total);
},
complete: function(xhr) {
status.html(xhr.responseText);
var responseJSON = $.parseJSON(xhr.responseText);
//var responseJSON = eval('('+xhr.responseText+')');

/*var DOMElement = $(".progress-block-template").clone();
var pagename = typeof($("#pagename").attr('value')=='undefined')?'':$("#pagename").attr('value');
processingData(responseJSON,DOMElement,pagename);*/
}
});

})();

这是使用 .html() 打印时得到的响应。

{
"data": {
"thumb_location": "http://XXXX.com/private/U/367/catalog/3/16285/thumbs/220x220.jpg?Expires=1349242125&Key-Pair-Id=APKAIGM4K33RYJKUHOXA&Signature=ptphhyF2GL6xe7xeosrzfKkpsXm7fWQAapcF3rjsZMuTwSCMhj2SZDIKtKGZ35-OJjTJ1LXu7wGEQlQvdKrBqT2oiOcPtL7etgTzRLe4~ub3KF64HhkglKv4DgzAWfvG5v8rNfmFvSja3HQ4K8m2o3h0Tl1uv7Lbwpqq0p71L5M_",
"user_id": "367",
"category_id": "3",
"category_type": "worksample",
"asset_id": 16285,
"project_id": null,
"file_name": "Chrysanthemum_37726.jpg",
"size": 879394
},
"success": "true"
}

但如果我执行 $.parseJSONeval 来解析 JSON 响应,它会自行终止执行。这仅在 IE 中发生,并且在 FF 和 Chrome 中正常工作。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com