1👍
I wound up changing my javascript to explicitly send a POST with the appropriate values rather than rely on the default “submit” behavior of the form in the dialog. The new code looks something like this:
function edit_model(model_id) {
var url = "http://www.mydomain.com/edit_model/?i=" + model_id
var edit_model_dialog = $("<div></div>");
$.ajax({
url : url,
type : "GET",
cache : false,
success : function(data) {
var title = "here is a form to edit the model"
edit_model_dialog(data);
edit_model_dialog.dialog({
title : title,
modal : true,
dialogClass: "no-close",
close : function() {
$(this).dialog("destroy");
},
// HERE IS THE NEW BIT...
buttons : {
ok : function() {
// GET THE DATA FROM THE FORM IN THE DIALOG...
var form_data = $(this).find("the_form").serialize();
$.ajax({
url : url
// EXPLICITLY SEND IT AS A POST...
type : "POST",
data : form_data,
cache : false,
success : function(data) {
if (data == "success") {
$(edit_model_dialog).dialog("close");
}
else {
$(edit_model_dialog).html(data);
}
}
});
},
cancel : function () {
$(edit_model_dialog).dialog("close");
}
}
}).dialog('open');
}
})
Source:stackexchange.com