2016-09-08 28 views
-1

私は編集可能なHTMLテーブルを持っています。私はすでにcontenteditableを使用していましたが、その後は変更を保存する方法がわかりません。私はそのページにいる間だけ保存しますが、リロードした後はページを初期値に設定します。テーブルは学校のためのプロジェクトです。私はアンドロイドアプリの開発について多くのことを知らないので、シンプルなソリューションは非常に高く評価されています。ここに私のコードは次のとおりです。テーブルの内容を編集してデータベースに保存します

<head> 
    <style> 
     th{ 
      background-color:lightblue; 
      font-weight:bold; 
      font-size:20p‌​t 
     } 
     .open{ 
      color:black; 
      background-color:lightblue; 
      font-size:15pt 
     } 
     .chapel{ 
      color:blue; 
      background-color:lightblue; 
      font-size:10pt‌​ 
     } 
    </style> 
</head> 
<body> 
    <table border=7 width=10%> 
     <tr></tr> 
     <tr> 
      <td align=center rowspan=2 class="open"><td> 
     </tr> 
    </table> 
    <div id="example-one" contenteditable="true"></div> 
</body> 
+0

を保存するためのユーザアヤックスは? –

答えて

0
jQuery(document).ready(function($) { 
jQuery("#savebtn").click(function(){ 
    $.ajax({ 
     url: 'ajax_url_address', 
     type: "POST", 
     cache: false, 
     dataType: 'json', 
     data : { 
      information : jQuery('#content').html(), 
     }, 
     success: function (response) { 
      if(response){ 
       // jQuery('#UserCityId').html(response.content); 
       alert('save successfull'); 

      }else{ 
       alert('not save'); 
      } 
     } 
    }); 

    }); 
}); 

DIVからのすべてのコンテンツを投稿し、あなたはどのようなデータベースソフトウェアを使用している

<div id="content"> 
    <table> {table content heare}</table> 
</div> 
関連する問題