javascript 发生错误时创建弹出对话框 Jquery Mobile
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15507533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating a popup dialog when an error occurs Jquery Mobile
提问by Kern Elliott
I want a dialog box to appear when an error occurs however I dont know how to do it. Where I would like the code to appear can be seen in the code below. So when this function is called a popup dialog box appears.
我希望在发生错误时出现一个对话框,但我不知道该怎么做。我希望代码出现的位置可以在下面的代码中看到。所以当这个函数被调用时,会出现一个弹出对话框。
.fail(function(){
alert("$.get failed!"); //replace with failed dialog
})
});
.fail(function(){
alert("$.get failed!"); //replace with failed dialog
})
});
回答by oueasley
So I'm guessing this is what you are talking about.
所以我猜这就是你所说的。
http://api.jquerymobile.com/popup/
http://api.jquerymobile.com/popup/
Have this embedded in your html somewhere.
将其嵌入到您的 html 中的某处。
<div data-role="popup" id="popupCloseLeft" class="ui-content" style="max-width:280px">
<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-left">Close</a>
<p>I have a close button at the top left corner with simple HTML markup.</p>
</div>
And then in your fail function just call this.
然后在你的失败函数中调用它。
$( "#popupCloseLeft" ).popup("open");