$("#tableData").on("click", ".recall", function() { var newsId = $(this).parent().data("news_id"); $.ajax({ type: "post", data: {newsId: newsId}, url: contextPath + "/news/recall", success: function(result) {// console.log(result); }, error: function() { } }); }); 现在按钮操作已实现但是需要刷新之后才能显示点击后的效果 该怎么修改?
1 回答

月关宝盒
TA贡献1772条经验 获得超5个赞
楼主的意思是删除功能
吧?点击删除后需要手动刷新?可以让其自动刷新:
success:function(result){ window.location.reload(); }
也可以移除整行:
$("#tableData").on("click", ".recall", function() { var newsId = $(this).parent().data("news_id"); //我不确定当前所在行是否是tr,就假设是tr吧 var $tr = $(this).parents('tr'); $.ajax({ type: "post", data: {newsId: newsId}, url: contextPath + "/news/recall", success: function(result) { //成功后直接移除当前行 $tr.remove(); }, error: function() { } }); });
添加回答
举报
0/150
提交
取消