【问题标题】:Dont Close Modal After AjaxAjax 后不要关闭模式
【发布时间】:2018-01-27 07:55:21
【问题描述】:

当我单击编辑并编辑表单时,我想重置作为 ajax 页面的页面背景,但是当我单击编辑时 ، 表单已编辑并关闭模态但未完全关闭模态

div ajaxshow 是布局上显示 ajax 页面的 div

function OnSuccess(data) {
    if (data.status) {
        swal({
            title: "AAAAAAAAAAAAAAAAAA",
            type: "success",
            text: data.message,
            showConfirmButton: false,
            timer:1500
        })

        $('#myModal').modal('hide');
        $.ajax({
            url: "/Forces/Index/",
            type: "Get",
            datatype: "html"
        })
        .done(function (result) {
            $('#ajaxshow').html(result);
        })
    } else {
        swal({
            title: "ثبت شده",
            type:"warning",
            text: data.message,
            showConfirmButton: false,
            timer: 1500
        })
    }
}

Edit Form before click edit

after edit but close modal completely

【问题讨论】:

  • 答案在于了解swal() 做什么来打开一个模态,然后知道使用什么表达式来正确关闭它。
  • 什么问题?
  • 只有你知道。我看不到里面swal()

标签: javascript jquery ajax


【解决方案1】:
function OnSuccess(data) {
    if (data.status) {
        swal({

            title: "AAAAAAAAAAAAAAAAAA",
            type: "success",
            text: data.message,
            showConfirmButton: false,
            timer:1500
        });

        $('#myModal').modal('hide');

        $.ajax({

            url: "/Forces/Index/",
            type: "Get",
            datatype: "html"
        })
        .done(function (result) {


            $('#ajaxshow').html(result);

        });


    } else {
        swal({

            title: "ثبت شده",
            type:"warning",
            text: data.message,
            showConfirmButton: false,
            timer: 1500
        });
    }
}

【讨论】:

    猜你喜欢
    • 2019-09-12
    • 1970-01-01
    • 2015-09-08
    • 2023-04-03
    • 1970-01-01
    • 2019-07-09
    • 2021-12-23
    • 1970-01-01
    • 2020-05-31
    相关资源
    最近更新 更多