ajax and forms using post
I cant figure out how to use ajax with form data when its posted to the server.
Here's my form that has been loaded into a div via ajax:
<form action="startattempt.php" method="post"><div><input type="submit" value="Continue the last attempt"><input type="hidden" value="54" name="cmid"><input type="hidden" value="pSRX4ou49yE" name="sesskey"></div></form>
This is what i have:
jQuery("#moodleAjax form").submit(function(event) {
event.preventDefault();
var uri = jQuery(this).attr("action");
var newHref = uriLogic(uri); // function does some stuff to get absolute link
jQuery("#moodleAjax").load(newHref+" #ajaxBody", null, moodleAjaxCustomisations); // the div moodleAjax is reloaded with action page
});
But this sends me to the page and not the data!