2017-03-04 58 views
0
$(document).on('click','.show_more',function(){ 
    var no = $(this).attr('id'); 
    $('.show_more').hide(); 
    $('.loding').show(); 
    $.ajax({ 
     type:'POST', 
     url:'index.php', 
     data:'id='+no, 
     success:function(html){ 
      $('#show_more_main'+no).remove(); 
      $('.snne').append(html); 
     } 
    }); 
}); 

AJAX不發送數據到PHP我嘗試這種回聲$ _ POST [「身份證」],但即時得到通知:未定義指數:ID錯誤也說,在主 同步的XMLHttpRequest線程已棄用AJAX不是將數據發送到index.php

回答

0

升級到jquery版本3.0以上解決此問題。

或者

此解決方案僅適用於某些情況下:

代替success方法使用done方法。

更換success:function(html){done:function(html){

編輯

在你的代碼async: true加入這一行。像這樣:

$.ajax({ 
     type:'POST', 
     url:'index.php', 
     asyc: true,//<---- insert this 
     data:'id='+no, 
+0

仍然是同樣的問題 – eness

+0

再次同樣的問題 – eness