• Ben

    (@benbornschein)


    Hello,

    your code

    function add_ajax_library() {
    
        $html = '<script type="text/javascript">';
            $html .= 'var ajaxurl = "' . admin_url( 'admin-ajax.php' ) . '"';
        $html .= '</script>';
    
        echo $html;
    }

    is missing a ; at the end. Correct code:

    function add_ajax_library() {
    
        $html = '<script type="text/javascript">';
            $html .= 'var ajaxurl = "' . admin_url( 'admin-ajax.php' ) . '";';
        $html .= '</script>';
    
        echo $html;
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Error in functions.php – Method add_ajax_library’ is closed to new replies.