I am writing some ajax code which will fetch updated information from my database.
However, I don't want to write my code to fetch updates at regular intervals. I wonder if it is possible to trigger the ajax code remotely?
I am writing some ajax code which will fetch updated information from my database.
However, I don't want to write my code to fetch updates at regular intervals. I wonder if it is possible to trigger the ajax code remotely?
You can do this with recent improvements in modern browsers which support web sockets. But for backwards compatibility you would need to look at using something like SignalR which uses Ajax polling to simulate a continuous connection.
https://github.com/SignalR/SignalR
Here are some links about polling:
http://ajaxpatterns.org/Periodic_Refresh
http://www.nickriggs.com/posts/simple-ajax-polling-plugin-for-jquery/