Irene T.
Irene T.

Reputation: 1393

Jquery load faile to load for second time

i am using the code bellow to reload a php file after 20 seconds inside a div, bu the problem is that after the first load on my target div it doesn't show anything.

any suggestions?

my code:

function getMyVideos(){
    $("#myvideos").load("http://www.mydomainz.com/myfile.php", function(){
        setTimeout(getMyVideos, 20000);
    });
}
$(document).ready(getMyVideos);
<div id="myvideos"></div>

Thank you all!

Upvotes: 0

Views: 182

Answers (1)

Magicprog.fr
Magicprog.fr

Reputation: 4100

You can probably use an anonymous function in your setTimeout function :

setTimeout(function(){getMyVideos();}, 20000);

Upvotes: 1

Related Questions