Created
October 10, 2015 15:42
-
-
Save Dinamiko/57847c00a75ff2fc8f26 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
<?php | |
/** | |
* crea registro con datos desde el formulario | |
*/ | |
function encuesta_ajax() { | |
// verifica nonce | |
if ( ! isset( $_POST['encuesta_nonce_field'] ) || ! wp_verify_nonce( $_POST['encuesta_nonce_field'], 'encuesta_action' ) ) { | |
print 'Sorry, your nonce did not verify.'; | |
exit; | |
} else { | |
$result['type'] = 'success'; | |
$result['msg'] = 'testeando...'; | |
$result = json_encode( $result ); | |
echo $result; | |
wp_die(); | |
} | |
} | |
add_action('wp_ajax_encuesta_ajax', 'encuesta_ajax' ); | |
add_action('wp_ajax_nopriv_encuesta_ajax', 'encuesta_ajax' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment