javascript - How to prevent long running service cause browser to popup Kill / Wait alert? -


in application , odata rest service called takes long time execute , return response. causes browser start showing wait / kill alert popup again , again till response comes.

this.getview().setbusy(true); //start showing busy indicator . . . settimeout(function() {     omodel.create('/serviceurl?sap-client='             + sapclient, requestobj, null, function(             data, oev) {      // success function         console.log('fffff');          that.getview().setbusy(false);         if (data.jsonout.indexof("message:") != -1) {             var arr = data.jsonout.split("message:");              sap.m.messagebox                     .alert(arr[1].split(",")[0]);         }          that.onbindtable();     }, function(err) {         // error function         that.getview().setbusy(false);         var errorobj = json.parse(err.response.body);          var smsgs = errorobj.error.message.value;         sap.m.messagebox.alert(smsgs);      }); }, 2000);  . . // rest of code gets executed  . . 

i have enclosed request inside settimeout() function make call asynchronous still problem persists. how avoid popup message showing ?

i suggest set fifth param of omodel.create method 'true' cause call asynchronous (and remove settimeout()).

omodel.create('/serviceurl?sap-client='             + sapclient, requestobj, null, function(             data, oev) {      // success function         console.log('fffff');          that.getview().setbusy(false);         if (data.jsonout.indexof("message:") != -1) {             var arr = data.jsonout.split("message:");              sap.m.messagebox                     .alert(arr[1].split(",")[0]);         }          that.onbindtable();     }, function(err) {         // error function         that.getview().setbusy(false);         var errorobj = json.parse(err.response.body);          var smsgs = errorobj.error.message.value;         sap.m.messagebox.alert(smsgs);      }, true); 

find hint there, not sure if it's revelent couldn't find javascript api reference.

https://archive.sap.com/discussions/thread/3503659


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -