• I’ve been working for this for 5 hours. No matter what I do, there is <pre></pre> in my output. I’ve tried at least 10 different javascript and php combinations for ajax. But none of them worked. pre haunts me.

    This is my PHP code:

    function ewfb_license_control_ajax(){
        wp_send_json_success();
        wp_die();
    }
    add_action( 'wp_ajax_ewfb_license_control_ajax', 'ewfb_license_control_ajax' );

    This is my javascript code:

    jQuery.post(ajaxurl, data, function (response) {
            console.log(typeof response);
            console.log(response);
     }, 'html');

    And this is my output:
    <pre></pre>{"success":true}

Viewing 1 replies (of 1 total)
  • Is the <pre></pre> the result of console.log(typeof response); ?
    Or is it because you use ‘html’ as the last parameter of jQuery.post() ?

Viewing 1 replies (of 1 total)
  • The topic ‘Why I have pre output in my ajax request?’ is closed to new replies.