diff options
author | Joey Hess <joey@kitenet.net> | 2012-07-30 20:22:10 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-07-30 20:22:10 -0400 |
commit | 9648acc7a4edd44a080f40d8e918b1388b24171a (patch) | |
tree | 52cbcbc30f2b0bc9be20ec3f0518f893f9c99b53 /static | |
parent | 9b1ed7a7200e087ecf3cfa8288a1197da0751136 (diff) |
got this JS working
Diffstat (limited to 'static')
-rw-r--r-- | static/longpolling.js | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/static/longpolling.js b/static/longpolling.js index 4e5f102f0..75c6faeaf 100644 --- a/static/longpolling.js +++ b/static/longpolling.js @@ -13,29 +13,26 @@ connfailed= ' </div>' + '</div>' ; -function longpoll(url, divid) { - (function( $ ) { - $.ajax({ - 'url': url, - 'dataType': 'html', - 'success': function(data, status, jqxhr) { - $('#' + divid).replaceWith(data); - connfails=0; - return 1; - }, - 'error': function(jqxhr, msg, e) { - connfails=connfails+1; - if (connfails > 3) { - // blocked by many browsers - window.close(); - $('#modal').replaceWith(connfailed); - $('#modal').modal('show'); - return 0; - } - else { - return 1; - } +function longpoll(url, divid, cont) { + $.ajax({ + 'url': url, + 'dataType': 'html', + 'success': function(data, status, jqxhr) { + $('#' + divid).replaceWith(data); + connfails=0; + cont(); + }, + 'error': function(jqxhr, msg, e) { + connfails=connfails+1; + if (connfails > 3) { + // blocked by many browsers + window.close(); + $('#modal').replaceWith(connfailed); + $('#modal').modal('show'); } - }); - })( jQuery ); + else { + cont(); + } + } + }); } |