admin管理员组文章数量:1353657
I am building RESTful mobile app and I like the default behaviour when resource is not found. jQuery Mobile shows this:
However, when I do my custom AJAX in onError (because resource is not found) I'd like to show fancy message (however, nothing happens in my code, default behavior is ignored):
$("#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();
}
I am building RESTful mobile app and I like the default behaviour when resource is not found. jQuery Mobile shows this:
However, when I do my custom AJAX in onError (because resource is not found) I'd like to show fancy message (however, nothing happens in my code, default behavior is ignored):
$("#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();
}
Share
Improve this question
asked Nov 25, 2011 at 9:43
XortyXorty
18.9k27 gold badges105 silver badges157 bronze badges
1 Answer
Reset to default 11//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();
});
本文标签: javascriptjQuery mobile How to invoke this (default) error loading page messageStack Overflow
版权声明:本文标题:javascript - jQuery mobile: How to invoke this (default) error loading page message? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743933484a2564270.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论