JQuery UI dialog modal form caching old values in AJAX application

后端 未结 2 953
醉话见心
醉话见心 2021-02-20 01:20

I am having a major headache using a form in a modal dialog with JQuery UI. The dialog is displayed when the user clicks on a link. The first time the form is opened, it works f

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-20 01:35

    From what I could interpret from your code, you are not actually removing the previous forms. You are just removing the dialog from them.

    The method is described as:

    Remove the dialog functionality completely. This will return the element back to its pre-init state.

    Meaning its still there.

    Try this (note the $('#divForm').remove();):

     $.post('/Item/Save', postData, function (response, status) {
                $('#divForm').remove();
                $('#divContent').html(response); //response mark up contains a new 'divForm' element
            }, 'html');
        }
    

提交回复
热议问题