jquery “everyTime” function

前端 未结 3 1469
陌清茗
陌清茗 2020-12-06 14:52

I\'m trying to refresh my recent list every 5 seconds. I was looking at ajax and found jquery.

I found a function known as \"everyTime\"

This is what I have

3条回答
  •  暖寄归人
    2020-12-06 15:33

    everyTime seems to be a jQuery plugin that has a lot of functionality you're not using here. For what you're doing, you can just use setInterval thus:

    setInterval(function() {
        // refresh list
    }, 5000)
    

    where the second parameter is the number of milliseconds.

    Note on everyTime

    If you really want to use everyTime, you'll need to make your first parameter a string, that is:

    $(document).everyTime("5s", function(i) { }, 0);
    

    Note the quotes around the 5s. You'll also need to include the appropriate javascript file for the plugin (not just for jQuery) at the top, i.e.

     
    

提交回复
热议问题