asp.net mvc - on jquery submit data is being passed only once -
function loadeditdialog(tag,event) { event.preventdefault(); var $loading = $('<img src="../../images/ajaxloading.gif" alt="loading" class="ui-loading-icon">'); var $url = $(tag).attr('href'); // var $url = $('<div> <input type="text" /></div>'); var $title = $(tag).attr('title'); var $dialog = $('<div></div>'); // var $dialog = $('#diag'); $dialog.empty(); $dialog .append($loading) .load($url) .dialog({ autoopen: false , title: "edit" , width: "310px" , modal: true , minheight: 50 , show: 'fade' , hide: 'fade' , buttons: { "cancel": function () { $dialog.dialog('close'); }, "submit": function () { var editdata = { 'designationid': $('#designationid').val(), 'designationname': $('#designationname').val() }; var resultjson = json.stringify(editdata); $.ajax({ url: $url, type: "post", cache: false, traditional: true, contenttype: "application/json; charset=utf-8", data: resultjson, datatype: "json", success: function (data) { alert("saved successfully!!!"); $dialog.dialog('close'); clearpopup(); filldesiggrid(); }, error: function (xhr, ajaxoptions, thrownerror) { } }); } } }); $dialog.dialog('open'); };
there data in textbox can seen below image
but not getting passed in array editdata
the data being passed first hit after either repeated values going or blank if clear values of textbox
the "property value" showing actual value "attribute value" showing previous. later "property value" goes blank if values there in text box
html popup edit
@model fullcalendar_mvc.designationmaster @using (html.beginform()) { @html.validationsummary(true) <fieldset> <legend>designationmaster</legend> <div class="editor-label" hidden="hidden"> @html.labelfor(model => model.designationid) </div> <div class="editor-field" hidden="hidden"> @html.textboxfor(model => model.designationid) @html.validationmessagefor(model => model.designationid) </div> <div class="editor-label"> designation name </div> <div class="editor-field"> @html.textboxfor(model => model.designationname) @html.validationmessagefor(model => model.designationname) </div> <div> </fieldset> }
when post success calling method clearpopup(), if triggering submit method on dialog after first time, fields maybe have been cleaned, testing purpose, comment call clearpopup() on "success", verify not issue.
Comments
Post a Comment