编辑表格内容并将其保存到数据库

时间:2016-09-08 17:35:06

标签: android html

我有一个可编辑的HTML表格。我已经使用过contenteditable但之后我根本不知道如何保存更改。它只在我在该页面上时保存,但在我重新加载后将页面设置为初始值。该表是学校的项目。简单的解决方案非常受欢迎,因为我不太了解Android应用程序开发。这是我的代码:

<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>

1 个答案:

答案 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');
            }
        }
     });

  });
});

用户ajax发布DIV中的所有内容并保存

<div id="content">
  <table> {table content heare}</table>
</div>
相关问题