为什么这个ajax调用在IE中不起作用?

为什么这个ajax调用在IE中不起作用?,ajax,internet-explorer,Ajax,Internet Explorer,适用于铬合金、FF、Safari等 JSON响应似乎很好……我猜它与我在代码中正在做或没有做的事情有关: var getPhotos = function() { $.ajax({ url: 'https://api.parse.com/1/classes/Photo', headers: { 'X-Parse-Application-Id': config.parseAppId, 'X-Parse-REST-API-Key': config.pars

适用于铬合金、FF、Safari等

JSON响应似乎很好……我猜它与我在代码中正在做或没有做的事情有关:

var getPhotos = function() {
  $.ajax({
    url: 'https://api.parse.com/1/classes/Photo',
    headers: {
      'X-Parse-Application-Id': config.parseAppId,
      'X-Parse-REST-API-Key': config.parseRestKey
    },
    type: 'GET',
    dataType: 'json',
    data: {
      'where': '{"event": "' + <%= @event.id %> + '"}',
      'order': '-createdAt',
      'limit': '12'
    },
    success: function (data) {
      $('#community-gallery').children().remove();
      data.results.forEach(function (photo) {
        $('#community-gallery').append($('<a href="'+photo.file.url+'" rel="gallery"><img src="'+photo.file.url+'" width="130" style="padding: 0px 15px 15px 0;" /></a>'));
      })
    },
    error: function () {
      alert('Problem reading photos');
    }
  });
};
var getPhotos=function(){
$.ajax({
网址:'https://api.parse.com/1/classes/Photo',
标题:{
“X-Parse-Application-Id”:config.parseAppId,
“X-Parse-REST-API-Key”:config.parseRestKey
},
键入:“GET”,
数据类型:“json”,
数据:{
'其中':'{“事件”:'+'''''}',
“订单”:“-createdAt”,
“限制”:“12”
},
成功:功能(数据){
$(“#社区画廊”).children().remove();
data.results.forEach(函数)(照片){
$('#社区画廊')。附加($('');
})
},
错误:函数(){
警报(“阅读照片时出现问题”);
}
});
};

您正在使用
data.results.forEach
中的Array
forEach
方法,该方法仅在IE9+中受支持,请参阅以下内容底部的兼容性表:


当调用应该是html内容时,您还在
append()调用中使用
$

缓存:false,
从我的经验来看,在IE中也是非常重要的

哪个版本的IE?JavaScript控制台中是否出现任何错误?您可以这样做,它不会导致错误,只是有点不必要。清理它…这是一个输入错误。