2013-04-05 128 views
0

我使用 的代碼Change table cell from span to input on click - 替換一個內聯編輯現在我想通過ajax發佈值,我不知道如何。 我只是想發佈用戶編輯的意見,並對其進行更新數據庫 上我這是怎麼走到這一步:內聯編輯的POST值

$.ajax({ 
     type: "POST", 
     url: "comments.php",//to update the comments 
     data: "data" 

       }); 

不知道要放什麼東西未來。當用戶點擊輸入區域時是否可以發佈值?並且數據是否必須是serialize
在此先感謝!

回答

0
$.ajax({ 
     type: "POST", 
     url: "comments.php",//to update the comments 
     data: {"comments":$("yourformId").serialize()}, 
     success:function(res) 
     { 
      //Do what ever you want 
     } 

      }); 

而在你comments.php只是print_r($_POST)如果使用form.serialize你會得到您所提交

+0

感謝我只是想回復的形式,所有數據都將讓你通過AJAX

張貼的陣列發表評論到MySQL – shell 2013-04-05 13:29:46