【发布时间】:2018-10-17 17:01:25
【问题描述】:
在 XMLHttpRequest 之后,一个函数会遍历 .records JSON,但是它只能在 chrome 或 Internet Explorer 中工作,不能同时在两者中工作。
问题在于.length 属性。
在 chrome 中,当我这样做时它可以工作:
request1.response.records.length
1438
在 Internet Explorer 中,我只能访问整个 JSON 正文,而不是 .records 的值,这在 chrome 中不起作用。
request1.response.length
30158
问题中的 JSON 开头为:
"{
"total":null,
"records":[{
"id":"5465464865",
"parentId": "545465",...
【问题讨论】:
-
在响应中发布调用
JSON.parse()的代码。
标签: javascript json xmlhttprequest iteration