AJAX jQuery refresh div every 5 seconds

前端 未结 5 518
忘了有多久
忘了有多久 2020-11-27 05:02

I got this code from a website which I have modified to my needs:




        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 05:57

    Try this out.

    function loadlink(){
        $('#links').load('test.php',function () {
             $(this).unwrap();
        });
    }
    
    loadlink(); // This will run on page load
    setInterval(function(){
        loadlink() // this will run after every 5 seconds
    }, 5000);
    

    Hope this helps.

提交回复
热议问题