當使用jQuery
和Ajax
,我通過整個網址阿賈克斯的url:
在情況下URL
都沒有了(不知),我怎麼會重定向到一個page not found
頁面從內ajax
本身? url
go和.htaccess
文件。jQuery的內部AJAX重定向的情況下,找不到網頁
$(document).ready(function() {
$('.link').click(function() {
var parentTag = 'check=checked';
if(parentTag) {
// ajax call
$.ajax({
type:"GET",
url:"/mylink/buyers/1/0/0", //If this failed, how do I redirect to something else from here?
data:parentTag,
dataType: 'json',
beforeSend:function(callBack){
console.log('checked');
},
success: function(callBack){
console.log('Success');
},
error: function(callBack){
console.log('Failed');
},
});
}
return false;
});
});
這不就是'error'回調做什麼?你可以用'this.status'找到http響應代碼(或者記錄'this',你會看到)。 – Rudie