user2878371
user2878371

Reputation: 3

IE10 function load setinterval not working

I have this piece of code:

$(function(){
    function load()
    {
        $("#queuerefresh").load("1.txt");
    }

    load();
    setInterval(load,1000);
});

Using: http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js

Which loads the content of a text file onto a div. This is set to refresh every 1 second so that as the text file is updated it shows in the div. This is working perfectly in Chrome however, it is not refreshing in IE10 unless I manually refresh the whole page? Please help.

Upvotes: 0

Views: 974

Answers (2)

codebreaker
codebreaker

Reputation: 1485

hi just try something like below should work..added some code for ie 10..now check it

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

    var refreshId = setInterval( function() 
    {
        $("#queuerefresh").load("1.txt");
    },1000);
});

Upvotes: 0

lionheart98
lionheart98

Reputation: 968

this seems to me to be a caching problem. You can avoid this by using ajax:

$(document).ready(function()
{
    function load()
    {
        $.ajax({
            url: "1.txt",
            cache: false, // very important in your case
            success: function(data)
            {
                $("#queuerefresh").empty();
                $("#queuerefresh").html(data);
            }
        });
    }
    load();
    setInterval(load,1000);
});

works for me in Chrome, Firefox as well as in IE

Upvotes: 1

Related Questions