Created
October 3, 2012 15:35
-
-
Save garyc40/3827617 to your computer and use it in GitHub Desktop.
WordPress AJAX form submission
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
jQuery('#myForm1').ajaxForm({ | |
data: { | |
// additional data to be included along with the form fields | |
}, | |
dataType: 'json', | |
beforeSubmit: function(formData, jqForm, options) { | |
// optionally process data before submitting the form via AJAX | |
}, | |
success : function(responseText, statusText, xhr, $form) { | |
// code that's executed when the request is processed successfully | |
} | |
}); |
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
<script src="https://gist.github.com/3827608.js"> </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the link you sent (https://gist.github.com/3827608.js) is empty.
for anyone needs to enqueue the build in jquery-form of Wordpress, can use this code:
add_action( 'wp_enqueue_scripts', 'inputtitle_submit_scripts' );
function inputtitle_submit_scripts() {
wp_enqueue_script('jquery-form'); // it will load /wp-includes/js/jquery/jquery.form.js
}