我试图$.mobile.showPageLoadingMsg()在用户点击登录按钮后使用jquery mobile .在这个操作之后我正在对webservice进行ajax调用,在得到响应之后我隐藏了加载消息.问题是加载器只在firefox浏览器中显示而不是在其他浏览器中显示(chrome,safari,android).
例:
$.mobile.showPageLoadingMsg();
var response = $.ajax(
{
type: "POST",
url: "service.php",
data: "...",
async: false,
dataType: "json",
cache: false
});
response.success(function (data)
{
res_content = data;
});
response.error(function (jqXHR, textStatus, errorThrown)
{
}
$.mobile.hidePageLoadingMsg();
Run Code Online (Sandbox Code Playgroud)
我还发现,如果我给hidePageLoadingMsg提供超时,那么加载器会显示出来.
setTimeout(function(){$.mobile.hidePageLoadingMsg()},5000);
Run Code Online (Sandbox Code Playgroud)
加载器需要更多时间才能显示出来,即它在ajax调用后显示并显示5秒.由于给出超时不是一个修复.请帮忙.