Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function create_nonce() {
- return wp_create_nonce('my-nonce');
- }
- add_action('wp_ajax_create_nonce', 'create_nonce');
- add_action('wp_ajax_nopriv_create_nonce', 'create_nonce');
- $('form').on('submit', function(e){
- e.preventDefault();
- var $form = $(this);
- request('create_nonce', function(nonce){
- // Append the fresh nonce to the form
- $form.append('<input type="hidden" name="nonce" value="'+nonce+'">');
- // Proceed with the form submission...
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement