0

我有一个函数可以连接并获取 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。

4

1 回答 1

2

尝试向您的 URL 添加一个唯一参数,例如

url: 'MiceDB.cfc?method=TempTableDateToRealData&getSex='+vGetSex+'&doWhat='+vDoWhat+'&ReturnFormat=json&t=' + new Date().getTime() + '&r=' + Math.random() * 999999,
于 2012-08-31T13:52:22.590 回答