>var $dlg = $("#add-edit-dialog").dialog({ > autoOpen: false, > show: "blind", > closeOnEscape: true, > resizable: true, > width: 1200, > height: 750, > minHeight: 600, > minWidth: 950, > buttons: { > Save: function () { > > if ($("#add-edit-form").valid()) { > > var urlLoc = '/Client/Edit/' + currentId; > if ($('#fntype').val() === "Add") > urlLoc = '/Client/Add'; > > var form = $('form', this); > //debugger; > var oForm = form.serialize() + '&'; > oForm = oForm.concat($('#frmClientsSearch').serialize()); > > $.ajax({ > type: 'POST', > url: urlLoc, > data: oForm, > dataType: 'json', > > cache: false, > //contentType: 'application/json', > success: function (result) { > > $('#flexClients').flexAddData(result); > } > }); > $(this).dialog('close'); > } else return false; > > }, > Cancel: function () { > > //var validator = $("#add-edit-form").validate(); > // validator.resetForm(); > > $(this).dialog("close").remove(); > // clearForm(); > } > }, > > close: function () { $(this).remove() }, > open: function () { > } >});>
>>>var validator = $("#add-edit-form").validate(); >>> >>>var $dlg = $("#add-edit-dialog").dialog({ >>> autoOpen: false, >>> show: "blind", >>> closeOnEscape: true, >>> resizable: true, >>> width: 1200, >>> height: 750, >>> minHeight: 600, >>> minWidth: 950, >>> buttons: { >>> Save: function () { >>> >>> if ($("#add-edit-form").valid()) { >>> >>> var urlLoc = '/Client/Edit/' + currentId; >>> if ($('#fntype').val() === "Add") >>> urlLoc = '/Client/Add'; >>> >>> var form = $('form', this); >>> //debugger; >>> var oForm = form.serialize() + '&'; >>> oForm = oForm.concat($('#frmClientsSearch').serialize()); >>> >>> $.ajax({ >>> type: 'POST', >>> url: urlLoc, >>> data: oForm, >>> dataType: 'json', >>> >>> cache: false, >>> //contentType: 'application/json', >>> success: function (result) { >>> >>> $('#flexClients').flexAddData(result); >>> } >>> }); >>> $(this).dialog('close'); >>> } else return false; >>> >>> }, >>> Cancel: function () { >>> $(this).dialog("close"); >>> clearForm(); >>> if (validator) >>> validator.resetForm(); >>> } >>> }, >>> close: function () { clearForm(); }, >>> open: function () { >>> } >>>});>>>