<button class='btn btn-success activeAccount'>Activate Account</button>
我在onclick事件上触发ajax调用,下面是ajax调用代码:
$(".activeAccount").click(function() {
var intCounselorId = $(this).parent().parent().find('input[class="counselorId"]').attr("value");
var intOwnerId = $(this).parent().parent().find('input[class="userID"]').attr("value");
var strAction = 'activateAccount';
performAction(intCounselorId, intOwnerId, strAction);
});
function performAction(intCounselorId, intOwnerId, strAction) {
$.ajax({
url: '/admin/counselormanagement/expertmanagementgridaction',
data: 'intCounselorId='+intCounselorId+'&intOwnerId='+intOwnerId+'&strAction='+strAction,
type: "POST",
async:false,
success: function(intFlag) {
if(intFlag == 1){
location.reload();
}
}
});
}
我正在尝试运行一个在第一页上正常工作的onclick事件,但是一旦我转到第2页(或任何其他),它就会停止工作.
我正在使用jquery-1.10.2.min.js和1.9.4版本的数据表
解决方法:
因为事件仅附加到现有元素.
您应该将其更改为:
$("#tableId").on("click", ".activeAccount", function(){
// your code goes here
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。