Site icon Hip-Hop Website Design and Development

script appear not load with use wp_enqueue_script

I am fairly new in wordpress plugin dev

I need to load some js for a plugin with ajax request.

To take action I’ve created the next code (I’ve eliminated the non mandatory code) :

all of the file is in the identical folder into plugins

script.js

console.log('loaded');
var ajax_url = wcdouchette_ajax_object.ajax_url;
console.log('ajax_url');

wc-douchette.php

class Wcdouchette {
    protected operate __construct() {
        $this->init();
    }

    public operate wcdouchette_includes() {
      // JavaScript
      wp_enqueue_script('wcdouchette-script-js', plugins_url( 'script.js', __FILE__ ));
      // Go ajax_url to script.js
      wp_localize_script(
        'wcdouchette-script-js',
        'wcdouchette_ajax_object',
        array( 'ajax_url' => admin_url( 'admin-ajax.php' ) )
      );
    }

    personal operate init() {
      if (get_site_url() === 'https://wp-pp.take a look at') $this->_isdev = true;
      add_action('wp_enqueue_scripts', array(&$this, 'wcdouchette_includes'));
      add_action('wp_ajax_wcdouchette_send_to_pmp', array(&$this, 'wcdouchette_send_to_pmp'));
      add_action('woocommerce_admin_order_actions_end', array(&$this, 'wcdouchette_btn_in_wcactions_column'));
      add_action('admin_menu', array(&$this, 'wcdouchette_options_page'));
      add_action('admin_init', array(&$this, 'wcdouchette_register_settings'));
    }
}

However i would not see any console.log. Any thought ?