当前位置:Gxlcms > PHP教程 > jquery回到json数组在firefox下正常可到了chrome下会丢失2个键值对应的值。为什么。

jquery回到json数组在firefox下正常可到了chrome下会丢失2个键值对应的值。为什么。

时间:2021-07-01 10:21:17 帮助过:7人阅读

jquery返回json数组在firefox下正常 可到了chrome下会丢失2个键值对应的值。。。为什么。。。
{"errcode":1,"data":{"name":{"103_0":"11111","id":"103","vkey":"103_0"},"key":{"11111":"103_0"},"file":{"":null},"url":{"":null}}} ----》chrome中取到的json

firefox下取到的json
{"errcode":1,"data":{"name":{"104_293":"\u5b66\u4e60\u5b66\u4e60\u5b66\u4e60\u4e0b","id":"104","vkey":"104_293"},"key":{"\u5b66\u4e60\u5b66\u4e60\u5b66\u4e60\u4e0b":"104_293"},"file":{"293":"award-46696.jpg"},"url":{"293":"http:\/\/hr.ryanren.dev.aifang.com\/upload\/train\/award\/award-46696.jpg"}}}

jquery:
function add_award(award_name,file_id){
jQuery.ajax({
url : award,
data :{
'name' : award_name,
'type' : 'add',
'file_id' : file_id,
'prof_id' : pro_id,
},
type : 'post',
async : false,
dataType : 'json',
success : function(mydata){
console.log(mydata);
var str =''+award_name+''+mydata.data.file[file_id]+'';
$("#info_award").append(str);
$("#pro_award").val('');
$("#upload_icon").val('');
},
error : function(){
alert("出错了,请您刷新页面,重新操作!");
}
});
}

分享到: 更多


------解决方案--------------------
你给出的两段 json 没有相同之处。
如何能知道少了什么呢?

人气教程排行