javascript - How to get rid of the 'progress' cursor? -
i have interval launches ajax call check if there update page (i imagine it's similar mechanism used facebook or stackexchange check new notifications). problem call changes cursor 'progress' or 'busy' cursor (visual problem) , disables option click on links (functional problem).
i suppose both problems related. how can rid of effect or @ least minimize consequences?
some code:
setinterval(function() { try { var mid = $($("ul#alert-messages li.regular")[0]).attr('ref'); call_ajax('/load_alerts', {num:0, id:mid}, function (data) { if (data.ok) { (var i=0; i<data.result.length; i++) { // .... } // ... } }, function() {}, // not show error this!! false); // not change cursor! } catch (e) {} }, 15000); function call_ajax(url, data, fnsuccess, fnerror) { $.ajax({ 'url': url, 'type': 'post', 'data': data, 'datatype': "json", 'success' : function(data) { if (fnsuccess) { fnsuccess(data); } else { if (typeof data.msg != 'undefined') { topbar(data.msg, typeof data.ok != 'undefined' && data.ok? 'message' : 'error'); } } }, error : function (jqxhr, textstatus, errorthrown) { console.log(errorthrown); if (fnerror) { fnerror(str_error_ajax + textstatus); } else { topbar(str_error_ajax + textstatus, 'error'); } } }); }
i think adding option async:true ajax call do. otherwise browser freeze until ajax stops , that's not want
Comments
Post a Comment