简体   繁体   中英

ajax jquery caching issue in IE

I have a function that connects and get sql query as results. Below function is what I have and it works perfectly fine in all other browser but IE. After some reading, I found out about the caching issue, so I included cache: false, . That didn't work. Then I added,

$.ajaxSetup({ cache: false });

top of the the script, still didn't do that trick. Here is the the complete function. Any help would be is greatly appreciated, because I don't know what am I doing wrong and I'm this close redirect users away from 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!');
      }
  });
}

UPDATE: I'm executing the above function onSubmit.

尝试为您的网址添加唯一参数,例如

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM