Refresh a PHP page for every predefined seconds

后端 未结 6 1040
一个人的身影
一个人的身影 2021-01-26 17:06

I would like to load/refresh a particular page for every 10 secs to view updated data\'s fetched from Database.

I used META for doing it

 

        
6条回答
  •  别那么骄傲
    2021-01-26 17:36

    Using AJAX is the least intruisive to the user, because the user doesn't notice that something is being refreshed/reloaded until it is complete.

    Please note that AJAX can perform better or worse than META depending on the situation:

    • If the data to be updated is small with respect to the full HTML page size, AJAX is better than META, because with AJAX you can send only the data difference, and/or you can send data in more compact format than HTML.
    • Running JavaScript puts a burden to the user's browser. If the user has 20 tabs open (which is not uncommon), and each of them runs some setTimeout in the background, it can make a huge difference in browser respoinsiveness to convert all of them to JavaScript-free refresh.

提交回复
热议问题