setInterval does not seem to be working?

前端 未结 2 562
伪装坚强ぢ
伪装坚强ぢ 2021-01-28 12:44

This code does not seem to be working. I am trying to create a dynamic list of chat rooms available that updates every 10 seconds. I also want the user to be able to set peramin

2条回答
  •  隐瞒了意图╮
    2021-01-28 13:13

    Try putting quotes around your function:

    setInterval('setRooms()', 10000);
    

    Alternatively change your method to:

    var setRooms = function()
    

    and you can then use:

    setInterval(setRooms, 10000);
    

提交回复
热议问题