IE中的ajax jquery缓存问题

时间:2012-08-31 13:45:30

标签: ajax jquery

我有一个连接并获取sql查询作为结果的函数。下面的功能是我所拥有的,它在所有其他浏览器中工作得很好,但IE。 经过一些阅读,我发现了缓存问题,所以我加入了cache: false,。那没用。然后我补充说,

  

$.ajaxSetup({ cache: false });

脚本的顶部,仍然没有做那个技巧。 这是完整的功能。非常感谢任何帮助,因为我不知道我做错了什么而且我这个关闭重定向用户远离IE

Check_MiceToCage = function(vGetSex,vDoWhat){
  $.ajax({
      type: 'POST',
      url: 'MiceDB.cfc?method=TempTableDateToRealData&getSex='+vGetSex+'&doWhat='+vDoWhat+'&ReturnFormat=json',
      dataType: 'json',
      cache: false,
      success: function(response) {     
        if(response.DATA.length == 0){
          //$("#ResponseID").html('No Male mice' + response.DATA.length);
          alert('No Mice' +vGetSex);
        }
        else{
          //$("#ResponseID").html('Yes we have male mice' + response.DATA.length);
          alert('Yes Mice' +vGetSex);
        }
      },
      error: function(ErrorMsg) {
         console.log('Error!');
      }
  });
}

更新: 我正在执行上面的函数onSubmit。

1 个答案:

答案 0 :(得分:2)

尝试在网址中添加唯一参数,例如

url: 'MiceDB.cfc?method=TempTableDateToRealData&getSex='+vGetSex+'&doWhat='+vDoWhat+'&ReturnFormat=json&t=' + new Date().getTime() + '&r=' + Math.random() * 999999,