[英]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.