Plugin development admin-ajax.php error 400?
-
I’m writing a plugin that should use ajax.
Here’s my part of the main file of the plugin:add_action( 'wp_enqueue_scripts', 'fhw_register_script' ); function fhw_register_script() { wp_deregister_script( 'jquery' ); add_action( 'wp_ajax_fhw_do_ajax_request', 'fhw_do_ajax_request' ); wp_register_script( 'jquery', 'https://code.jquery.com/jquery-latest.min.js'); wp_register_script( 'fhw_formular', plugins_url( '/js/formular.js', __FILE__ ), array( 'jquery' ) ); wp_enqueue_script( 'fhw_formular' ); wp_localize_script( 'fhw_formular', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'we_value' => 1234 ) ); wp_enqueue_script( 'jquery' ); }
So if I call the formular.js my dev-console says
Filed to load resource: the server responded with a status of 400 (Bad Request)
for the File admin-ajax.php. What to do?
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Plugin development admin-ajax.php error 400?’ is closed to new replies.