So for some reason IE just loves to cache things for you when you call an ajax method, thus my JQuery get ajax call not working in IE.
Something like
$('#mybutton').live('click', function() {
$.post('SaveLanguage', { lang : $(this).val(), null, null);
$.get('GetLanguage', null, function(html) { $('#myDiv').replaceWith(html); });
});
This will work every time in firefox but IE will just call the cache version, thus whatever you have changed in the post version would not matter.
To fix this one can use datetime to append to the query string in each call or just use jquery ajaxSetup like
$.ajaxSetup({ cache: false});
$('#mybutton').live('click', function() {
$.post('SaveLanguage', { lang : $(this).val(), null, null);
$.get('GetLanguage', null, function(html) { $('#myDiv').replaceWith(html); });
});
or use the $.ajax call and pass in cache: false.
View Comments (6)
great! I just changed get to post and now it's working everytime in IE
Wonderful ! I was having the same problem . It helped me a lot to fix .Many thanks .
Here are a few other ways to solve this issue as well: http://www.itworld.com/development/303295/ajax-requests-not-executing-or-updating-internet-explorer-solution
Thanks a lot.
It's helped me to fix the IE 11 Issue.
Excellent, this was driving me crazy, thank you.
Thanks a lot. It's is simple and super!