我使用jQuery数据表插件进行分页,这个插件工作得很好,我试图刷新计数器的内容,显示在底部的分页后,删除行与删除功能的ajax与jQuery。请参阅附件。

只要delete函数被调用,它就会正确地删除整行,但不能更新底部的计数器值。每当我刷新页面时,它都会更新该值

我的删除函数代码是:-
var conf = jQuery.noConflict();
conf(document).ready(function(){
conf(document).on("click", ".delete", function() {
//alert(conf(this).attr("id"));
proid = conf(this).attr("id");
var r=confirm("Press a button!");
if (r==true)
{
var url = "<?php echo Mage::getBaseUrl();?>/turnkey/index/deleteproduct/";
conf.ajax({
type:"POST",
url:url,
data: { 'proid':proid},
success: function(msz){
alert(msz);
if(msz=="deleted") {
conf("#hidepro"+proid).hide("slow");
}
else {
//conf("#hidepro"+proid).hide();
alert("product cant be deleted");
}
//console.log("chal hun");
}
});
}
else
{
return false ;
}
});
});建议我在哪里做了一些修改。
发布于 2014-02-28 14:25:44
您需要为count元素提供一些ID。假设计数在一定范围内,
<div id='rec_cnt'>Your Count</div>您需要在处添加一行,
if(msz=="deleted") {
conf("#hidepro"+proid).hide("slow");
$('#rec_cnt').html((parseInt($('#rec_cnt').html()) - 1))
}https://stackoverflow.com/questions/22087662
复制相似问题