I need to get a button to trigger a jQuery UI dialog box, which AJAX requests a page based on GET params supplied in the tag of the inital link.
The AJAX loaded page will then retrieve data from a DB based on the supplied GET params, and be displayed to the user as a populated form.
The user should then be able to edit these populated form fields and click “Save”, where the form fields will then be POST’ed to another script (can be self, or separate if necessary).
The scipt that handles the POST data will return true or false, if false an error will be supplied, if true the box needs to close, job done.
This is as far as I’ve got, but hit problems trying to get my head around dealing with the POST (do I need a seperate script for this?)
$(function (){
$('a.edit').click(function() {
var url = this.href;
dialog.dialog({
close: function(event, ui) {
dialog.remove();
},
modal: true
});
dialog.load(
url,
{},
function (responseText, textStatus, XMLHttpRequest) {
}
);
return false;
});
});
<a class="edit" href="handle.php?d=838474&f=37446374">
use Id instead of class.
and its better not to update the same element from which you are fetching data.