2016-07-27 60 views
0

大家好我尝试执行此请求警告XMLHttpRequest来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/. 

什么想法? 在此先感谢!

+0

您是否尝试过向您的网址添加回调? '...&回调=?' – ethane

回答

2

某处某处将async设置为false,并且它不在您共享的代码中。

很有可能你打电话给ajaxsetup某处设置为async。你应该找到它并将其删除。

(作为一种快速入侵,您可以在选项对象中粘贴async: true)。