【发布时间】:2011-12-02 18:33:59
【问题描述】:
大家好,我多年来一直在研究这个特殊问题,请帮忙。 我看过jQuery: Refresh div after another jquery action? 它正是我想要的,但只有一次!我有一个从 db 生成的表,当我单击删除时,它会删除行并刷新 div,但之后我的 jquery 函数都将不起作用。
$('#docs td.delete').click(function() {
$("#docs tr.itemDetail").hide();
var i = $(this).parent().attr('id');
$.ajax({
url: "<?php echo site_url('kt_docs/deleteDoc'); ?>",
type: 'POST',
data: 'id=' + i,
success: function(data) {
$("#docs tr.itemDetail").hide();
$("#f1").html(data); // wont work twice
//$("#docs").load(location.href+" #docs>*"); //works once as well
}
});
});
我的身体里有
<fieldset class='step' id='f1'>
<?php $this->load->view('profile/docs_table'); ?>
</fieldset>
profile/docs 从 db 读取数据。 <table id='docs'>....</table>
和我的控制器:
function deleteDoc() {
$id = $_POST['id'];
$this->load->model('documents_model');
$del = $this->documents_model->deleteDocument($id);
return $this->load->view('docs_table');
}
提前致谢!
【问题讨论】:
标签: php jquery codeigniter