Skip to content
Advertisement

I am trying to load the script into my Elementor Widget and i am getting a Failed to load resource: net::ERR_CONNECTION_REFUSED on my WordPress

    public function __construct($data = [], $args = null) {
        parent::__construct($data, $args);
  
        wp_register_script( 'slider-script', get_template_directory_uri() . '/elements/elementor/flexible-posts/slider.js', [ 'elementor-frontend' ], '1.0.0', true  );
        wp_register_script( 'flex-script', get_template_directory_uri() . '/elements/elementor/flexible-posts/js/script.js', [ 'elementor-frontend' ], '1.0.0', true  );
     }
  
     public function get_script_depends() {
         return [ 
            'slider-script',
            'flex-script'
        ];
     }

Error screenshot

Failed to load resource: net::ERR_CONNECTION_REFUSED

Advertisement

Answer

It is properly enqued already and the errors you’re getting are for the different script and the script you’ve enqued are already showing the Console.log() test message you’ve added.

I see there is no problem with enqueing the script, you might be dealing with some other issue, please continue with debugging.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement