Support » Fixing WordPress » AJAX nonce with check_ajax_referer()

  • ronnyrook

    (@ronnyrook)


    Hi there,

    I want to use check_ajax_referer() to verify a WP_nonce field using AJAX. Here you can find my html element.

    <input type=”hidden” name=”ogin_nonce” value=”<?= wp_create_nonce(‘jrwd_login_nonce’); ?>”/>

    Using jQuery I’m sending all the values from input fields to a POST request:

    request = $.ajax({
    type: ‘POST’,
    url: ‘handle-login.php’,
    data: inputs.serialize(),
    dataType: ‘json’
    });

    I’m sending the data serialized, but that shouldn’t be a problem I suppose. In handle-login.php I’m try doing the following:

    check_ajax_referer( ‘login_nonce’, $_POST[‘login_nonce’], false )

    But all I get in the return is an ‘Internal services error’..
    This looks like my problem, but unfortunately this question is unsolved.

    Someone knows what is up?

  • The topic ‘AJAX nonce with check_ajax_referer()’ is closed to new replies.