gettint error 400 with AJAX

i can’t see the action parameter in your code it should be: let ajax = new XMLHttpRequest(); ajax.open(“GET”, search_x.ajaxurl + ‘?action=search_data’, true); ajax.send(); ajax.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { console.log(this.ajax); } }; see this reference about action parameter https://codex.wordpress.org/AJAX_in_Plugins

How to add javascript code into Divi child theme?

You’re almost there, change code in functions.php to: <?php function my_theme_enqueue_styles() { $parent_style=”divi-style”; wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ ); wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array( $parent_style ), wp_get_theme()->get(‘Version’) ); wp_enqueue_script( ‘et_mobile_nav_menu’, get_stylesheet_directory_uri() . ‘/js/selectpage.js’, array( ‘jquery’ ), true ); } add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); ?> Now your script should be located at: /wp-content/themes/divi-child/js/selectpage.js

It is possible that your caching plugins are preventing the script from loading. Your site may also be http and not https, hence the reason why https script cannot load. Try changing the script to http: <script src=”http://www.palloliitto.fi/torneopal/ajax/[torneopal:scoretable:competition=splfutsal1920%26amp;class=FL%26amp;group=1%26amp;key=XHGVMHFIQB]”></script> If that doesn’t help, send us a link to the page where you inserted it.

register dependency css and js inside a plugin class

You’re using the incorrect hook. The only hook is wp_enqueue_scripts (plural). You use wp_enqueue_style() and wp_register_script() etc. on that hook, but the hook is always the same. So this: add_action(‘wp_enqueue_script’ , array( $this, ‘initBootstrap’ )); add_action(‘wp_enqueue_style’ , array( $this, ‘initBootstrap’ )); add_action(‘wp_register_script’ , array( $this, ‘initParallax’ )); add_action(‘wp_register_style’ , array( $this, ‘initParallax’ )); add_action(‘wp_register_script’ , … Read more