Home > Software design >  I am trying to load the script into my Elementor Widget and i am getting a Failed to load resource:
I am trying to load the script into my Elementor Widget and i am getting a Failed to load resource:

Time:04-05

    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

CodePudding user response:

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.

CodePudding user response:

slider-script and flex-script both files are properly enqueued. Failed to load resource: net::ERR_CONNECTION_REFUSED ( this error is coming due to liverelaod.js file is not found on the given path).

  • Related