They’re not the same though. Look at the form data on each one. The second one, the one that doesn’t work, has _test appended to the parameter names and the action value.
The reason you’re getting a 400 error is because you’re not sending a valid action. The action parameter is how WordPress determines which callback to use to handle the request. If you don’t send action with a valid value, no callback exists to handle the request and it returns a 400 error.
You need to make sure the parameter is called action, not action_test, and the value is the proper name you’re using in PHP. In your case that appears to be return_reason, not return_reason_test.
Related Posts:
- WordPress Plugin Development – Headers Already Sent Message
- How can I run AJAX on a button click event?
- What is nonce and how to use it with Ajax in WordPress? [duplicate]
- Empty POST data on server on AJAX request using Angular $http
- Build path for a custom portfolio plugin
- Headers already sent error with CSV export plugin
- Using AJAX in a plugin to submit form – REALLY confused
- wp_localize_script $handle
- Get file headers in custom file
- Using ob_start() in plugin
- Adding custom code into header.php using a plugin
- Adding callback function for wp_ajax_ has no effect
- get all products of one category
- The plugin generated 80 characters of unexpected output!
- Get returned variable from a function to add_shortcode function
- How to post form in ajax mode and handle it in wordpress
- Using Ajax call in jQuery doesn’t work in widget
- WP_LOCALIZE_SCRIPT doesn’t work
- Admin-ajax.php appending a status code to ajax response
- Ajax in WordPress – path issue
- Header Button Chance Polylang Elementor
- Cannot search post by taxonomy
- WordPress Ajax callback function from plugin – OOP
- WP AJAX is not working, always returns 0
- Frontend Ajax call not working using wp_ajax, wp_enqueue_script and wp_localize_script
- An echo line in a transition_post_status action leads to “cannot modify header information – headers already sent by”
- Slow WP_query due to nested wp_query. Need Suggestions
- Woocommerce checkout update totals with datepicker
- Including the necessary functions for a custom ajax registration form
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- How to localize admin.php only once
- Dashboard – get status and position of metaboxes and pass them to ajax method
- How to get Metabox custom field to show checked if value is updated using post meta query?
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- Storing data in wordpress database from ajax call from different website
- Create custom HTML/JS app inside page
- Use just a shortcode from another page
- How to give a download link to a .csv file from the custom plugin?
- wp_localize_script is not adding a global variable for javascript
- Can’t get AJAX call working in custom plugin
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- 400 Bad Request, in wordpress theme development, wp_ajax
- Ajax is not working in a loop
- How to get error object returned by wp_create_user
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- ajax working when function is on child theme but not in plugin page
- AJAX call to admin-ajax.php by subscriber returns home page
- Ajax function is not working on WordPress
- About a programming language starts with [closed]
- add_action wp_ajax_ not loading in plugin file WP Network
- Workflow for new importer plugin – your advices?
- Ajax +wordpress onClick link redirect to new page and create html content
- AJAX request not routing through proxy
- Why does website stretch and white space on load? [duplicate]
- WordPress (pagenow link) in ajaxurl change after i change plugin language
- Ajax on the Administration Side of plugin – returns 0
- How to do admin ajax request in a plugin for rest api
- Ajax action has 200 status but response of No response data available for this request
- Jquery php request is returning a weird result
- WordPress Does not grab the string sends useing AJAX response, wp_ajax hook
- Posts form with AJAX request – Plugin development
- GET request return value as error instead of success
- Bad request 400 using class based files
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- ajax stopped working when not logged in wordpress
- ajax response strips multidimensional array and unable to decode
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Rate limiting ajax requests in WordPress
- ajax-action.php can’t find added action
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- AJAX call of function containing javascript which is not loaded (Plugin development)
- $_SESSION inside php function executed by AJAX
- ajax multiple Values
- How to include files in the loop via ajax
- How to handle ajax Request in a complex-structured plugin?
- Using JavaScript in WordPress page to call for server data using AJAX
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Filterable posts using categories
- How to get values from Tinymce visual editor popup?
- Ajax Response Error | just getting error as the response
- Some data has already been output, can’t send PDF file – fpdf issue in WordPress
- Headers already sent on custom plugin (Export function)
- PHP includes with AJAX actions
- admin-ajax.php returns “No Script Kiddies!” sometimes
- WordPress function is not called and ajax return 0
- Ajax call not working with
- Ajax functionality not being called under wordpress plugin
- Array/List Edit in Backend
- WP Cron as Fast as WordPress AJAX?
- WordPress plugin: admin-ajax.php not passing data to custom function
- Ajax functions – no access to wp-admin.php only online
- Fatal error: Call to a member function query() on a non-object in my ajaxpage
- Page reload occurs before request finishes
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- Return custom product in ajax call loop
- Why is there a bunch of WordPress HTML code in my browser CSV download?
- Issue in Creating Dynamic URL in custom wordpress plugin