Reputation: 174
I would like to show the loading spinner while a function is running in jquerymobile. The function is non ajax its just going to calculate some values and save to a sqlite db. I have searched and i keep finding the same examples saying use $.mobile.showPageLoadingMsg(); etc.
example
function loading()
{
$.mobile.showPageLoadingMsg();
//Do Some Stuff in here
$.mobile.hidePageLoadingMsg();
}
Thanks In advance. Lmac
Upvotes: 1
Views: 3402
Reputation: 51
Use $.mobile.loading( 'show' ); and $.mobile.loading( 'hide' ); instead. Functions above are deprecated from jquery mobile documentation.
Upvotes: 1
Reputation: 3512
You can simply call:
$.mobile.showPageLoadingMsg();
at the beginning of your function as you mentioned but on a callback of your function
$.mobile.hidePageLoadingMsg();
If you wanted the loader to appear for a certain period of time you could use:
$.mobile.showPageLoadingMsg();
var wait = setTimeout(function(){
$.mobile.hidePageLoadingMsg();
},400);
Upvotes: 1