我在这个问题上大发雷霆。我有一个 .html 页面来代表我的移动应用程序的主页。在同一个 html 页面中,我有一个页面定义为登录屏幕。显示登录屏幕的逻辑工作得很好......我的问题是我有一个具有以下签名的登录功能......
ajaxLogin(credentials, successCallback, failureCallback) {
$.ajax({
url: SERVER_API + '/login',
data: credentials,
type: 'post',
async: true,
beforeSend: function () {
$.mobile.showPageLoadingMsg(true);
},
always: function () {
console.log('always');
$.mobile.hidePageLoadingMsg();
},
done: function (data, status, xhr) {
console.log('login: ok'); //< -- This never fires but I can see that the server returned a 200 in Safari's developer menu
successCallback();
},
fail: function (request, error) {
failureCallback(); // <-- This function is never executed when I send bad login info. But again, the server is returning an error status code
}
});
}
我认为这很简单……我错过了什么吗?