Currently, I am facing some challenges with the data being posted when working with forms inside jQuery Dialog. The initial load and save of the data work correctly. However, after refreshing the page, subsequent loads display the correct data in the form but end up posting the data from the first load every time.
function formdialog(url, tack, divid, scriptload){
$.getJSON(url+tack+"/form", function(data){
var formwin = '<div><form id="formdialog">'+data['form']+'</form></div>';
var dialog = $(formwin).dialog({
title: data['title'],
autoOpen: false,
modal: true,
buttons: {
"Save": function(){
$.post(url+tack+"/process",
$("#formdialog").serialize(),
function(data){
alert($("#formdialog").serialize());
$(this).dialog('close');
$(this).remove();
}
);
},
"Cancel": function(){$(this).dialog('close'); $(this).remove();}
}
});
dialog.dialog("open");
});
}
$(function(){
$("a.edlnk").click(function(){
var url = $(this).attr("href");
formdialog(CONFIG_HREF_SITE+"ajax/"+appControl, "/"+url, divid);
return false;
});
});