How can I monitor the newly added content in the database and automatically refresh the page immediately? how can I monitor the newly added content in the database and automatically refresh the page immediately? Php?
Reply to discussion (solution)
"Automatically refresh the page", the best way is to use ajax to poll
Send a request to the backend to check whether the database has been updated, refresh, or no updates at intervals (for example, five seconds ).
Ajax ?? Check ????? The latest id. if yes? If it is different from the cookie value you saved? Update, same? Set the new id? Cookie
Ajax timed request.
How can I monitor the newly added content in the database and automatically refresh the page immediately? Php?
In the html5 era, event-stream can be used.
The common practice is ajax. of course, you can also use the method of regularly refreshing the page-or...
In the html5 era, event-stream can be used.
Event-stream has a disadvantage. it does not support IE well. it is not suitable for the current situation in China.