[英]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.