Hello,
i have a js function which gets html to create new employee from controller, inserts it inside a form tag (for later .serialize()), and then inserts this html to createDialog div and shows this div as dialog.
<div id="createDialog" style="display:none;">
</div>
$.get('/Employee/Create',
function (html) {
html = "<form id='createEmp'>" + html;
html = html + "</form>";
$("#createDialog").html(html);
$("#createDialog").dialog({
modal: true,
width: 500,
buttons: { "Save": function () { postEmployee(); } },
close: function (ev, ui) { $(this).dialog('destroy'); }
});
});
function postEmployee() {
$.post('/Employee/Create',
$("#createEmp").serialize(),
function (html) {
$('#reply').html(html);
});
}
this works, but only once. with every next post all form fields from previous posts are also added to current post. can this be fixed ?
Tahnk You !