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();
});