Jquery auto refresh div

后端 未结 3 1982
走了就别回头了
走了就别回头了 2020-12-16 04:45

Jquery auto refresh is using up a LOT of browser memory. Is there a way to stop this. I had a 2 div refreshing every 3 seconds but I moved it up to 9 and 15 seconds, It help

3条回答
  •  余生分开走
    2020-12-16 05:25

    Try changing it to this:

    // ...
    $('#details2').empty().load('links2.php').fadeIn('slow');
    

    It may halp to explicitly tell jQuery to empty the container first, so it can free up any event handlers etc. (Though it's not clear that there would be any handlers in there ...)

    edit — actually never mind; I checked the jQuery sources and it looks like calling .html() (which load() does, I'm pretty sure) seems to always call empty() first anyway.

提交回复
热议问题