Search code examples
phpjavascriptajaxrefreshhead

Ajax auto refresh & javascript


I have a page which reloads a DIV with AJAX every 5 seconds. I also have an AJAX sorting script (you can see it here). The sorting script works great when I visit the page for first time, but when the page is refreshed it doesn't work.

Am I doing something wrong? I have the sorting script in the HEAD tag, and the refresh on the bottom because I want to use some PHP variables there.


Solution

  • If your refresh code repopulates the <div>, it's probably destroying the event handler associations that your table sorter established. Perhaps you need to re-run the table sorter initialization after each refresh.