2016-02-25 33 views
0

我想從包含dataTables表的頁面加載jQueryUI模式窗口。模式窗口的按鈕位於dataTable的一行中。另一個模式按鈕不在dataTable上。我得到的錯誤:主線程上的同步XMLHttpRequest被棄用 - jqueryui對話框/ dataTables

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help http://xhr.spec.whatwg.org/

我真的有一個很難理解這意味着什麼,以及如何處理它。這裏是我的代碼:

var recdt = $('#LettTable').DataTable({ 
    "paging": false, 
}); 

//******Modal edit letter text form 
//Following is for popups for simple forms================ 
var edit_let_url; 
$("#edit-let-modal").dialog({ 
    autoOpen: false, 
    height: 500, 
    width: 500, 
    modal: true, 
    //async:true, 
    buttons: { 
     "Save": function() { 
      $.post(edit_let_url, 
       $('#edit-let-form').serializeArray(), 
       function(data) { 
        if (data) { 

         //pass ex_id as data for preview redirect 

         window.location.href = "/app/letters_config/"; 

        } else { 
         alert('Did not save'); 
         $('#edit-let-form').html(data); 
        } 
       }) 
      $(this).dialog("close"); 
     }, 
     Cancel: function() { 
      $(this).dialog("close"); 
     } 
    } 
}); 

$('#LettTable').on('click touchstart', '.edit_lett', function() { 
    //$('.edit_lett').click(function(){ 
    edit_let_url = $(this).attr('name'); 
    $("#edit-let-modal").load(edit_let_url).dialog("open"); 
}); 
+0

您所顯示的代碼中沒有同步AJAX請求,因此我們無法爲您提供相關解決方案。也就是說,通常這是由'$ .ajax()'請求中的'async:false'造成的。您應該刪除該屬性並將任何代碼依賴於回調函數中返回的數據。 –

+1

我想我記得有人遇到這種情況,如果您正在加載的頁面正在做一些

相關問題