Show Page Loading Spinner on Ajax Call in jQuery Mobile

后端 未结 8 1923
说谎
说谎 2020-11-29 23:42

I\'m using $.ajax() to populate a list in my mobile web app. What I\'d like to do is have the jQuery mobile loading spinner appears while this call is being performed and di

8条回答
  •  星月不相逢
    2020-11-30 00:32

    Before JQM 1.2:

    $(document).ajaxStart(function() {
        $.mobile.showPageLoadingMsg();
    });
    
    $(document).ajaxStop(function() {
        $.mobile.hidePageLoadingMsg();
    });
    

    Since JQM 1.2:

    $(document).ajaxStart(function() {
        $.mobile.loading('show');
    });
    
    $(document).ajaxStop(function() {
        $.mobile.loading('hide');
    });
    

    http://api.jquerymobile.com/page-loading/

提交回复
热议问题