Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery mobile: How to invoke this (default) error loading page message?

I am building RESTful mobile app and I like the default behaviour when resource is not found. jQuery Mobile shows this:

enter image description here

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();
}
like image 881
Xorty Avatar asked Dec 21 '22 05:12

Xorty


1 Answers

//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();
  });
like image 55
GerjanOnline Avatar answered Jan 03 '23 10:01

GerjanOnline