单击 jQuery Mobile 的提交按钮后,如何显示“加载”弹出窗口?

Posted

技术标签:

【中文标题】单击 jQuery Mobile 的提交按钮后,如何显示“加载”弹出窗口?【英文标题】:How can I show the 'loading' pop up after I click on the submit button for jQuery Mobile? 【发布时间】:2011-12-06 00:44:02 【问题描述】:

我正在使用 jQuery Mobile javascript 库。以我的形式,我似乎无法实现这个form 正在做什么。在我点击提交按钮后。我希望用户看到“正在加载”弹出窗口。

【问题讨论】:

【参考方案1】:

重要

请注意Michael Kariv的以下评论:

至少在 jqm 1.3.2 中已弃用,可能更早。查看代码显示

showPageLoadingMsg: function( theme, msgText, textonly ) 
    $.mobile.loading('show', theme, msgText, textonly );

原来的答案是:


$('#yourform').submit(function()
    $.mobile.showPageLoadingMsg(); // http://jquerymobile.com/test/docs/api/methods.html
)

再次隐藏消息:$.mobile.hidePageLoadingMsg();

【讨论】:

是否有回调来检查提交是否完成,以便我知道何时可以调用'$.mobile.hidePageLoadingMsg();'? 是的,我通过 ajax 提交。 然后使用您的 AJAX 回调! $.post(url, data, function() $.mobile.hidePageLoadingMsg(); ); 已弃用,至少在 jqm 1.3.2 中,可能更早。查看代码显示 showPageLoadingMsg: function( theme, msgText, textonly ) $.mobile.loading( 'show', theme, msgText, textonly ); ,

以上是关于单击 jQuery Mobile 的提交按钮后,如何显示“加载”弹出窗口?的主要内容,如果未能解决你的问题,请参考以下文章