Welcome to WebmasterWorld Guest from 54.166.122.69

Forum Moderators: open

JQuery AJAX only loading once in IE

   
4:23 pm on Oct 20, 2011 (gmt 0)

5+ Year Member



I am having an issue with the following code only loading once in IE, it loads fine repeatedly in Chrome, FF, and safari. If anyone has any suggestions I would greatly appreciate it:


<script type="text/javascript">
var c=0;

setInterval(function() {
$.ajax({
type: "GET",
url: 'randomize.php',
success: function(data) {
$('#dispeople').html(data);
}
});
},2000);


</script>
4:55 pm on Oct 20, 2011 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



You're probably getting a cached version in IE. Add some dynamic value to the URL to prevent it from caching.

url: 'randomize.php?ck=' + (new Date()).getTime(),
6:38 pm on Oct 20, 2011 (gmt 0)

5+ Year Member



Thanks for the suggestion, i tried that along with adding this above the JQuery:

$.ajaxSetup ({
// Disable caching of AJAX responses
cache: false
});

and am still experiencing the same issue, any other thoughts?
6:38 pm on Oct 20, 2011 (gmt 0)

5+ Year Member



So now i have this for the entire code block:

<script type="text/javascript">
var c=0;

$.ajaxSetup ({
// Disable caching of AJAX responses
cache: false
});

setInterval(function() {
$.ajax({
type: "GET",
url: 'randomize.php?ck=' + (new Date()).getTime(),
success: function(data) {
// data is ur summary
$('#dispeople').html(data);
}
});
},2000);


</script>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month