[Solved] Div with id exists but not recognised by jQuery [closed]


You don’t need setInterval at the first place. All you need to do is to wait for the first load to complete, in the complete callback, do a setTimeout which would reload the div with the set delay. Hope that helps.

$(document).ready(function() {
    //Store the reference
    var $elem = $('#wallboard');
    //Create a named self executing function
    (function loadPage() {
        $elem.load('refresh_wall2_test.php', function() {
            //When the request is complete, do a timeout which calls the function again.
            window.setTimeout(function() {
                loadPage();
            }, 5000);
        });
    }());
});

3

solved Div with id exists but not recognised by jQuery [closed]