Jquery Mobile发生错误时创建弹出对话框

Ker*_*ott 3 javascript jquery-mobile

我想在出现错误时出现一个对话框,但我不知道该怎么做.我希望代码出现在下面的代码中.因此,当调用此函数时,会出现一个弹出对话框.

.fail(function(){ alert("$.get failed!"); //replace with failed dialog }) });

oue*_*ley 8

所以我猜这就是你在说什么.

http://api.jquerymobile.com/popup/

将它嵌入你的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>
Run Code Online (Sandbox Code Playgroud)

然后在你的失败函数中调用它.

$( "#popupCloseLeft" ).popup("open");
Run Code Online (Sandbox Code Playgroud)