Forum Replies Created

Viewing 1 replies (of 1 total)
  • Including nonce in this plugin would be great. I tried to do it myself, with this on the client side:

    jQuery(document).ready(function(){
        jQuery('.clickme-btn').on('click', function(){
            var data = {
    			'security': '<?php echo wp_create_nonce('load_post'); ?>'
            }
    		jxAction('click_action1',data);
        });
    });
    

    and this on the PHP side (function.php)

    
    add_action('jx_click_action1', function($jx){
        check_ajax_referer('load_post', $jx->data['security'],true);    
        $jx->alert('Hello, world!');
    });
    

    But this is what is returned

    Wrong jx JSON response (not JSON): Forbidden jx.js:136:12

Viewing 1 replies (of 1 total)