setInterval not calling function
get_alerts = function(alerts_url) {
return $.getJSON(alerts_url, function(alerts) {
return $("#alerts_box").html("" + alerts.length + " Alerts");
});
};
window.setInterval(function() {
return get_alerts($("#alerts_box").data("alerts-url"));
}
, 1000);
If I put a breakpoint in the setInterval area, I get notified every
second, but the getJSON call is never being executed. Looking at my server
logs, there is never a request to the alerts_url.
UPDATE Appears to be an intermittent Chrome problem. Fired it up on Safari
and it worked as expected. Clearing out Chrome now and I'll try again.
No comments:
Post a Comment