【问题标题】:jsonp - internet explorer and loopjsonp - Internet Explorer 和循环
【发布时间】:2017-05-01 07:40:36
【问题描述】:

在 Internet Explorer 中使用 jsonp 时遇到问题。

我的代码:

$.ajax({
    url: 'my url',
    cache: false,
    dataType: "jsonp",
    crossDomain: true,
    async: true,
    success: function(data) {
        i = 0;
        for (var ix=0;ix<data.length;ix++) {
            item = data[ix];
            v = item['value']

在 chrome 上一切正常,我循环数据并获取所有值“v”。

在 Internet Explorer 上,我得到了正确的数据,但是当我迭代时,“项目”是错误的。 “data”是正确的,“ix”是正确的,但“item”是不正确的。

如果我查看数据,我有一个包含 s“值”的项目的列表。 但是“item”对于“[prototype]”、“arguments”、“caller”和“prototype”来说有些奇怪。

你有什么想法吗?谢谢

【问题讨论】:

  • 你能显示console.log(JSON.stringify(data))的输出吗?
  • 您好,您可以在这里查看脚本:actecil.fr/agenda-des-formations
  • 输出打印在控制台中。 pastebin 中的输出:pastebin.com/LVeHvsvR
  • 那里的任何对象都没有value 属性。
  • 第一个看起来像{"location":"Marseille","formations":[{"dates":["Mardi 16 Mai","Mercredi 17 Mai","Jeudi 18 Mai 2017"],"sectors":["Généraliste"],"wordpress_page_id":"catalogueformationscnil/catalogue-des-formations-cnil-formations-labellisees-par-la-cnil/cil","formation":"Formation Labellisée : Exercer le métier de correspondant Informatique et Libertés","logo":"https://tools.actecil.fr/media/actecil_intraapps/formation/2016/11/label-actecil-formation-CIL.png","formation_id":2}]}

标签: javascript jquery internet-explorer jsonp


【解决方案1】:

问题解决了,

我用过,没问题

$.each(data, function(k, item) {

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-11
    • 2016-07-02
    • 2010-10-21
    • 2014-05-20
    • 2012-08-31
    • 2018-12-14
    • 2013-01-06
    • 2011-03-31
    相关资源
    最近更新 更多