2012-11-29 49 views
1

我當前的鏈接導致404是正確的行爲。jQueryMobile:獲取頁面加載失敗的結果

現在服務器返回我想用作頁面的HTML代碼。

$(document).bind('pageloadfailed', function(e, data) { 
    // use html from 404 result as var page that should be displayed now 
    data.deferred.reject(data.absUrl, data.options, page); 
    return false; 
}); 

回答

2

XMLHttpRequest help page on W3C並通過檢查jQuery Mobile的代碼,我會說,它應該可以得到這樣說:

$(document).bind('pageloadfailed', function(e, data) { 
    // use html from 404 result as var page that should be displayed now 
    var htmlSource = data.xhr.responseText; // this should contain your page source 
    data.deferred.reject(data.absUrl, data.options, page); 
    return false; 
});