嗨我做了这个功能,我可以在确认后删除一行。 问题是,删除后,表格不会重新加载。我必须刷新页面,以便表可以重新加载。我是ajax的新手,我想学习,如果可能的话,我怎样才能自动重新加载数据表。这是我的ajax jquery代码
function delete_province(PROV_ID)
{
if(confirm('Are you sure delete this data?'))
{
// ajax delete data to database
$.ajax({
url : "<?php echo site_url('Provinces/ajax_delete')?>/"+PROV_ID,
type: "POST",
dataType: "JSON",
success: function(PROV_ID)
{
//if success reload ajax table
$('#modal_form').modal('hide');
reload_table();
},
error: function (jqXHR, textStatus, errorThrown)
{
alert('Error deleting data');
}
});
}
}
表
</head>
<body>
<div class="container">
<br />
<a href = '<?php echo base_url().'Provinces/add_view'; ?>' class = 'btn btn-success pull-left fa fa-plus'>  Add New</a>
<br />
<br />
<br />
<table id="table" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>#</th>
<th>Province</th>
<th style="width:125px;">Action</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th>#</th>
<th>Province</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>