Nonces
-
Hi
I’m new to nonces but trying to implement on my forms.I use localize script to set it up..
wp_localize_script( ‘my-ajax-request’, ‘MyAjax’, array(
‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ),
// generate a nonce
‘postCommentNonce’ => wp_create_nonce( ‘myajax-post-comment-nonce’ ),
)In my JS I use the following process…
jQuery.post(the_ajax_script.ajaxurl, jQuery(“#theForm”).serialize()
,
function(response_from_the_action_function){
// Return the response and JSON parse to access the array
$returntext = JSON.parse(response_from_the_action_function); etc…However, the parsed JSON is not then correct as the nonce seems to mess irt up and I then I can’t seem to check my nonce anyway.
Probably have the wrong end of the stick…
Any help would be useful…
The topic ‘Nonces’ is closed to new replies.