[英]Warning XMLHttpRequest to ejecute ajax
大家好,我嘗試執行此請求
var post_url = "https://www.googleapis.com/books/v1/volumes?q=isbn:0716604892";
var text_area = $('#isbn_textarea').val().trim();
$.ajax({
dataType: 'json',
url: post_url,
type: 'GET',
success: function(response) {
var out = "";
alert(response);
},
error: function(response) {
alert('mal');
}
})
但是我得到這個警告
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
任何想法? 提前致謝!
某處某處將async
設置為false
,並且不在您共享的代碼中。
您最有可能在設置async
某個地方調用了ajaxsetup
。 您應該找到它並刪除它。
(作為一個快速的技巧,您可以在選項對象中使用async: true
)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.