弹出窗口没关闭

时间:2013-08-20 05:23:14

标签: ajax jquery spring-mvc

我有一个弹出窗口,应该在提交期间关闭。但它没有关闭,但数据正在添加到网格中。使用的脚本是

$(document).ready(function(){
    $("#dialog-form").dialog({
        autoOpen : false,
        height : 400,
        width : 700,
        modal : true,
        title: "Currency Details",
        close : function() {
            $(this).dialog("close");
        }
    });

});

这是我的ajaxsubmit

function saveCurrencyAjax() {
        var str = $("#enumCurrency").serialize();
        $.ajax({
            type : "POST",
            url : "../currency/saveEnumCurrency.action",
            data : str,
            success : function(response) {
                $('#dialog-form').dialog('close');

            },
            error : function(e) {
                alert('Error: ' + e);
            }
        });
    };

这是我的控制器

  @RequestMapping( value="/currency/saveEnumCurrency.action", method=RequestMethod.POST)
        public ModelAndView saveenumCurrency(@ModelAttribute EnumCurrency enumCurrency, Errors errors) throws Exception {   

            ModelAndView mvc = null;
            try{
                List<EnumCurrency> enumCurrencys =  new ArrayList<EnumCurrency>();
                enumCurrencys.add(enumCurrency);
                List<EnumCurrency> enumCurrencysList = enumCurrencyService.create(enumCurrencys);
                mvc =   new ModelAndView("setup/enumCurrencyList");


            } catch (Exception e) {
                e.printStackTrace();
            }
            return mvc; 
        }

如果需要更多信息,请提前致谢。

1 个答案:

答案 0 :(得分:0)

首先确认它是否成功功能!并尝试这个

$('div#popup_content').bind('dialogclose', function(event) {
     alert('closed');
 });

参考 - Accepted Answer of this question

试试