What makes you think AJAX is inappropriate?
You can write a function that dispatches an XMLHttpRequest
GET
request to the relevant endpoint (let's call it /stocks
), and sends the ID of the most recent datum as a query string parameter (e.g., /stocks?later_than={id}
).
Your server-side code can return all data later than the ID'd datum.
You can use window.setInterval
to call that function at a regular interval, or renew the request in a callback executed when the previous request receives a response.
It sounds like you might be asking about WebSockets. Here is a StackOverflow discussion of the relative merits of AJAX and WebSockets.
Here is another great StackOverflow resource covering different approaches to polling.