Created
December 21, 2008 22:47
-
-
Save traviskroberts/38782 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function to send the jQuery form object via AJAX | |
jQuery.fn.submitWithAjax = function() { | |
this.submit(function() { | |
// be sure to add the '.js' part so that it knows this is format:js | |
$.post(this.action + '.js', $(this).serialize(), null, "script"); | |
return false; | |
}) | |
return this; | |
}; | |
$(document).ready(function() { | |
// once the page has completely loaded, | |
// make forms with the class "remote" submit via AJAX | |
$("form.remote").submitWithAjax(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment