additional information
The way you described will work. From experience, I would just like to point out some things.
:
var isActive = true;
$().ready(function () {
pollServer();
});
function pollServer()
{
if (isActive)
{
window.setTimeout(function () {
$.ajax({
url: "...",
type: "POST",
success: function (result) {
pollServer();
},
error: function () {
pollServer();
}});
}, 2500);
}
}
, , , . , - , .