[英]jQuery AJAX load() div table after loaded buttons are not working
目前有这个问题,我有 ajax 请求发送表单数据并将其保存到数据库,保存后我使用 load() function 刷新表中的列表,但加载后加载的 div 内的按钮不起作用这也使用 js。
Ajax
var formData = new FormData(this);
$.ajax({
url: "/systemadmin/storemanagement/"+id,
method: "POST",
data:formData,
cache:false,
contentType: false,
processData: false,
success:function(data){
console.log(data)
$("#storeDatatable").load(location.href + " #storeDatatable");
$(".message-error").remove();
$(".message-success").remove();
$('#store-update-header').append('<div class="message-success">Update succesfully</div>');
}, error:function (err) {
if (err.status == 422) {
console.log(err.responseJSON);
$(".message-error").remove();
$(".message-success").remove();
$.each(err.responseJSON.errors, function (i, error) {
$('#store-update-header').append('<div class="message-error">'+error[0]+'</div>');
});
}
}
});
通过使用解决$(document).on('click','.toggleModal-updateStore', function(){ })
代替$('.toggleModal-updateStore.').on('click', function(){ })
对于行内的按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.