我想单击$(。excluirs)时刷新表格。该表是从PHP数据加载。当我点击按钮时,php代码就会执行,并且我从数据库中删除数据。 但我想刷新表格的内容。所以,我试图再次调用函数completeTable();
,但它没有工作。警报出现,但表不刷新。javascript递归函数
function completeTable(){
$.post("completa_tabela.php", {cd_turma: $('#turma').val()}, function(data){
data = jQuery.parseJSON(data);
$.each(data.json, function(){
var button = "<button type='button' class='excluir' value='" + this['codigo'] + "'>X</button>";
$('#' + this['dia_hora']).html(this['nome'] + button);
});
$('.excluir').click(function(){
$.post("altera_horario.php", {excluir: true, cd_horario: $(this).val()}, function(){
alert("$('excluir').click");
completeTable();
});
});
});
}
我该怎么做?
-1:这不解决OP的问题,'.bind'和'.live'一直以来的jQuery 1.7弃用。 –
谢谢,我们可以在Satpal使用'on'时使用它。 – Omidam81