gpt4 book ai didi

javascript - jQuery 手机 : How to invoke this (default) error loading page message?

转载 作者:搜寻专家 更新时间:2023-11-01 04:58:24 24 4
gpt4 key购买 nike

我正在构建 RESTful 移动应用程序,我喜欢找不到资源时的默认行为。 jQuery Mobile 显示了这个:

enter image description here

但是,当我在 onError 中执行自定义 AJAX(因为找不到资源)时,我想显示花哨的消息(但是,我的代码中没有任何反应,默认行为被忽略):

$("#some-place").bind("pageshow", function() {
$.ajax({
type: "POST",
url: "some-place/places.json",
cache: false,
dataType: "json",
success: onSuccessInitPlaces,
error: onErrorInitPlaces
});
return false;
});

function onSuccessInitPlaces(data, status) {
// do stuff, not important atm
}

function onErrorInitPlaces(data, status) {
// pseudocode I'd like to invoke for real
// should show attached picture
invokeFancyErrorLoadingPage();
}

最佳答案

//show error message
$( "<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>YOUR MESSAGE</h1></div>" )
.css({ "display": "block", "opacity": 0.96, "top": $(window).scrollTop() + 100 })
.appendTo( $.mobile.pageContainer )
.delay( 800 )
.fadeOut( 400, function() {
$( this ).remove();
});

关于javascript - jQuery 手机 : How to invoke this (default) error loading page message?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8267159/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com