$ .mobile.showPageLoadingMsg()不起作用

时间:2013-05-27 12:10:24

标签: javascript jquery jquery-mobile cordova settimeout

我是jquery mobile的新手,同时发出ajax请求我用来显示加载消息,直到从服务器获得响应。我为此尝试了很多但没有用。任何人都可以提前帮助我解决这个问题..

吼叫ajax电话代码

        $.ajax({ 
    url: "url", 
    type: "GET",
    contentType: "application/json; charset=utf-8",                  
    beforeSend: function(){
     setTimeout(function(){
     $.mobile.loading('show');},1);  
     },
     success: function(msg) {
      // $.mobile.loading('hide');
     $.each(msg.empWall, function() {   
      alert(this.name);          
      });
      },
      error: function(err) {
      alert(err.toString());
      },
      complete: function(){
      setTimeout(function(){
     $.mobile.loading('hide');
     },1);  
     });

1 个答案:

答案 0 :(得分:5)

Web-kit浏览器在jQuery Mobile加载程序的编程执行方面存在问题,但它可以像这样执行:

显示:

setTimeout(function(){
    $.mobile.loading('show');
},1);  

<强>隐藏

setTimeout(function(){
    $.mobile.loading('hide');
},1);  

他们只需要由 setTimeout setInterval 功能引起的小延迟。