4
我正在构建RESTful移动应用程序,并且我喜欢找不到资源时的默认行为。 jQuery Mobile的显示了这个:jQuery手机:如何调用此(默认)错误加载页面消息?
然而,当我做我的自定义AJAX中的onError(因为资源没有找到)我想显示看中消息(但是,什么也没有发生在我的代码,默认行为被忽略):
$("#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();
}
完美,谢谢! – Xorty
只有'display:block'对于css是必要的,如果你确定你的div与标准错误div具有相同的类。 – alquatoun