Created
October 3, 2012 15:16
-
-
Save garyc40/3827500 to your computer and use it in GitHub Desktop.
WordPress ajax submit code
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.post( | |
// see tip #1 for how we declare global javascript variables | |
MyAjax.ajaxurl, | |
{ | |
// here we declare the parameters to send along with the request | |
// this means the following action hooks will be fired: | |
// wp_ajax_nopriv_myajax-submit and wp_ajax_myajax-submit | |
action : 'myajax-submit', | |
// other parameters can be added along with "action" | |
postID : MyAjax.postID | |
}, | |
function( response ) { | |
alert( response ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment