加载按钮后 jQuery AJAX load() div 表不起作用

问题描述 投票:0回答:2

目前遇到这个问题,我有ajax请求发送表单数据并将其保存到数据库,保存后我然后使用load()函数刷新表中的列表,但加载后,加载的div内的按钮不起作用也用js。

阿贾克斯

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>');
                });
            }
        }
    });
javascript jquery
2个回答
2
投票

通过使用
解决

$(document).on('click','.toggleModal-updateStore', function(){ }) 

而不是
$('.toggleModal-updateStore.').on('click', function(){ })

对于行内的按钮


0
投票

GENIOOOOOOOOO 我已经解决了这个问题,但没有任何解决办法...最后我是 hubiera ocurrido 时代的 cambiar eso。乘坐巴士前往 asi 的功能

© www.soinside.com 2019 - 2024. All rights reserved.