相关疑难解决方法(0)

jQuery mobile:如何调用此(默认)错误加载页面消息?

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

在此输入图像描述

但是,当我在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();
}
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery jquery-mobile

4
推荐指数
1
解决办法
4376
查看次数

标签 统计

ajax ×1

javascript ×1

jquery ×1

jquery-mobile ×1