Update meta values with AJAX
Couple of things: 1: When you include the script after jquery, localise it using the wp_localize_script function: $nonce = wp_create_nonce(“vote_nonce”); $yourscript_info = array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’), ‘nonce’ => $nonce ); wp_localize_script( ‘yourscript’, ‘yourscript’, $yourscript_info ); $.ajax({ type: “POST”, url: yourscript.ajaxurl, data: { id: id, vote: vote, nonce: yourscript.nonce, action: “stn_voting” }, 2: Add some … Read more