jquery dialog 关闭找不到对象问题

 var dialog = $( "#dialog-add" ).removeClass('hide').dialog({
                  modal: true,
                  title: "新增用户",
                  title_html: false,
                  width: 800,
                  buttons: [ 

                      {
                          //text: "保存",
                          html: "<i class='ace-icon fa fa-check'></i>&nbsp; 保存",
                          "class" : "btn btn-primary btn-xs",
                          click: function() {
                              
                              var reqURI = "<%=request.getContextPath()%>/userProfileAddStatistics/userProfileAdd.c";
                              var params = {};
                              var formId = "GCFORM";
                              var frm = document.getElementById(formId);
                              setParamForm(frm,params);
                              
                              if (checkUserForm()) {
                                  $.ajax({
                                      type: "POST",
                                      url: reqURI,
                                      data: params,
                                      cache: false,
                                      success: function(retData){
                                           if(retData.ret != 1) {
                                               alert("保存失败,请联系系统管理员!");   
                                           } else {
                                               alert("保存成功!");
                                               $(dialog).dialog( "close" );
                                               //jQuery("#grid-table").trigger("reloadGrid");
                                               loadProfile();
                                           }
                                      }
                               });
                              }
                          } 
                      },
                      {
   //text: "关闭",
   html: "<i class='ace-icon fa fa-times'></i>&nbsp; 关闭",
   "class" : "btn btn-xs",
   click: function() {
       $(dialog).dialog( "close" ); 
   } 
}
                  ]
              });
posted on 2015-07-03 10:42  _故乡的原风景  阅读(210)  评论(0编辑  收藏  举报