Jquery模型弹出窗口没有关闭 [英] Jquery model popup is not closing

查看:93
本文介绍了Jquery模型弹出窗口没有关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看员工名单。为了编辑员工,我在模态弹出窗口中打开了一个editemployee局部视图。弹出代码在下面

I have view of employee list. For editing of an employee i have a opened a editemployee partial view in a modal popup. the popup code is below

$(".empEdit").on("click", function () {
           var id = $(this).attr('id');
           $("#dialog-edit").load("EditEmployee/" + id);
           $("#dialog-edit").dialog({
               title: 'Employee Edit',
               height: 655,
               width: 400,
               modal: true,
               buttons: [{
                   id: "SubmitButton",
                   text: "Update",
                   click: function () {
                       $.ajax({
                           type: "Post",
                           url: "EditEmployee",
                           data: "EmpId=" + $("#EmpId").val() +
                               "&EmpName=" + $("#EmpName").val() +
                               "&EmpSal=" + $("#EmpSal").val() +
                               "&EmpContact=" + $("#EmpContact").val() +
                               "&EmpGender=" + $("#EmpGender").val() +
                               "&EmpDOJ=" + $("#EmpDOJ").val() +
                               "&EmpDOB=" + $("#EmpDOB").val(),
                           success: function (data) {
                               var response = $(data);
                               $("#empList").find("tr").eq(response.data("EmpId")).replaceWith(response);
                               $("#dialog-edit").dialog("close");
                           },
                           error: function (data) {
                               alert("Employee Updation Failed");
                           }
                       });
                   }

               }]
           });
       });





当我点击更新按钮时模型弹出窗口没有关闭

请任何人救命。我做错了。



我收到一个错误,比如在初始化之前无法在对话框上调用方法;尝试调用方法'关闭'



When i am clicking on Update button the model popup is not closing
please anybody help. What I did wrong.

I got an error like "cannot call methods on dialog prior to initialization; attempted to call method 'close'"

推荐答案

(。empEdit)。on(click,function(){
var id =
(".empEdit").on("click", function () { var id =


(this)。 attr('id');
(this).attr('id');


(#dialog-edit)。load(EditEmployee /+ id);
("#dialog-edit").load("EditEmployee/" + id);


这篇关于Jquery模型弹出窗口没有关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆