我有以下的碼位,我特林運行
$.ajax({
cache: false,
url: './animationPlay.php',
data: 'animation='+text,
type: 'POST',
datatype: 'text',
success: function(data) { alert("succsess") },
error: function(ts) { alert('error:'+ts.responseText) }
});
我見過how to catch ajax query post error?和jQuery $.get or $.post to catch page load error (eg. 404),但它不工作對我code.It被簡單地設置「錯誤」。我如何獲得有關錯誤的更多細節?
在此先感謝。
編輯: 我試過
error: function(xhr, textStatus, error){
console.log(xhr.statusText);
console.log(textStatus);
console.log(error);
}
我有錯誤,錯誤,在控制檯一個空字符串。這是什麼意思?
不顯示任何空白提示 – Apb
@Baadshah - 他在代碼中顯示他正試圖捕獲錯誤,但'ts.responseText'不會返回任何內容 – ChrisW
嘗試從url中刪除'.'。所以它是'url:'/ animationPlay.php'' –