javascript - $.each data() 在 Firefox 和 chrome 上返回不同的结果

标签 javascript jquery json

我收到了由

发送的这种 json
{
   "media":{
      "1369725029":{
         "id_profil":"5738",
         "photo_profil":"http:\/\/www.mupiz.com\/5738\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle chanson",
         "nom_media":"La Douleur (chanson sur mon tableau)",
         "nom_profil":"KRISS",
         "url_profil":"kriss",
         "streaming":"\r\n  <div class=\"playerMedia\" onclick=\"InlinePlayer(this)\" data-url=\"http:\/\/www.mupiz.com\/mp3\/5738\/mp3_51550.mp3\" data-id=\"mp3_51550.mp3\">La Douleur (chanson sur mon tableau)<\/div>\r\n",
         "url_media":"http:\/\/www.mupiz.com\/kriss\/la-douleur-chanson-sur-mon-tab"
      },
      "1369723360":{
         "id_profil":"5738",
         "photo_profil":"http:\/\/www.mupiz.com\/5738\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle chanson",
         "nom_media":"On the Hi-Way (chanson)",
         "nom_profil":"KRISS",
         "url_profil":"kriss",
         "streaming":"\r\n  <div class=\"playerMedia\" onclick=\"InlinePlayer(this)\" data-url=\"http:\/\/www.mupiz.com\/mp3\/5738\/mp3_54344.mp3\" data-id=\"mp3_54344.mp3\">On the Hi-Way (chanson)<\/div>\r\n",
         "url_media":"http:\/\/www.mupiz.com\/kriss\/on-the-hi-way-chanson1"
      },
      "1368389617":{
         "id_profil":"32236",
         "photo_profil":"http:\/\/www.mupiz.com\/32236\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle vid\u00e9o",
         "nom_media":"P!nk - Just Give Me A Reason ft Nate Ruess (Real Chanty Cover) ",
         "nom_profil":"Real Chanty",
         "url_profil":"RealChanty",
         "streaming":"<iframe width=\"270px\" height=\"200px\" src=\"http:\/\/www.youtube.com\/embed\/xiDzmc59fjg\" frameborder=\"0\" allowfullscreen><\/iframe>",
         "url_media":"http:\/\/www.mupiz.com\/RealChanty\/video\/p-nk-just-give-me-a-reason-ft-nate-ruess-real-chanty-cover"
      },
      "1368384065":{
         "id_profil":"1388",
         "photo_profil":"http:\/\/www.mupiz.com\/1388\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle chanson",
         "nom_media":"On the Hi-Way (chanson)",
         "nom_profil":"Fred.Baz1-Compositeur-Bassiste-Guitariste",
         "url_profil":"fred-bazin",
         "streaming":"\r\n  <div class=\"playerMedia\" onclick=\"InlinePlayer(this)\" data-url=\"http:\/\/www.mupiz.com\/mp3\/1388\/mp3_49786.mp3\" data-id=\"mp3_49786.mp3\">On the Hi-Way (chanson)<\/div>\r\n",
         "url_media":"http:\/\/www.mupiz.com\/fred-bazin\/on-the-hi-way-chanson"
      }
   }
}

Chrome 得到了“正确”的顺序,而 FF 则没有,

有什么想法吗?

最佳答案

我认为您不能依赖 JSON 对象中属性的排序 - JSON 可以按任何顺序返回。

来自 JSON 规范 http://www.json.org/

An object is an unordered set of name/value pairs

可能重复吗? JSON order mixed up

关于javascript - $.each data() 在 Firefox 和 chrome 上返回不同的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16826743/

相关文章:

javascript - 在数组中分配一个javascript对象和对象

javascript - 检查滚动是否被触发

android - 没有 google-services.json,Google 服务插件无法运行

javascript - jQuery 可以使用某种模块模式吗?

javascript - 按 Javascript 中的不同元素排序

Javascript 从字符串时间和日期获取 Date() 对象

javascript 未捕获 TypeError : ")". find 不是用于在页面刷新时保存选项卡选择的函数

javascript - 多个选择下拉列表的计算

php - 在 PHP 中访问包含不常见变量名称的数组

json - 此弹性json查询映射有什么问题?