![](/img/trans.png)
[英]Handling the response from `res.download()` on the client side (Rest api, express)
[英]handling client side error from REST API
我使用ajax()
,得到的結果是對象數組的列表。 當用戶傳遞無效的參數時,而不是服務器端給我一個無效的消息,它給了我致命錯誤(PHP)。 我無法控制PHP,如果響應無效,應該如何捕捉?
我不能respond == 'undefined'
。
我認為您正在使用jQuery的$ .ajax()?
$.ajax({
url: 'myphpfile.php',
type: 'get',
datatype: 'json',
success: function(data) {
alert('No PHP file error');
}
// now with error handling
,error {
alert('PHP file error');
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.