ajax的回調函數


ajax的回調函數(done,fail,always)

觀看代碼:

 1  $.ajax({
 2             type: "post",//請求的類型
 3             url: "/book/detail?act=lsid",//請求路徑帶參數
 4             data: {id: id}
 5         }).done(function (da) {
 6             $("#bookId").val(da.id);
 7             $("#bookname").val(da.name);
 8             $("#bookprice").val(da.price);
 9             $("#bookauthor").val(da.author.trim());
10             $("#bookpress").val(da.press.trim());
11         }).fail(function (xhr, textStatus, errorThrown) {
12             alert("原生ajax:" + xhr + textStatus + "詳細錯誤:" + errorThrown);
13         }).always(function () {
14             console.log("完成任務流程結束");
15         })

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM