I think that main problem here is that you try to use “fail” to indicate the state where form has errors. This is wrong, because ajax call will “success” even when form will have errors, because from jquery point of view – it made a ajax call and got response.
Fail will be called only on 404 errors etc.
Related Posts:
- Displaying PHP Errors from admin-ajax.php
- Ajax Redirect role = ‘Editor’ to their Dashboard after register
- Check if username exist with AJAX
- How to check username availability with ajax at registration
- How to solve “Updating failed” with 403 Error when trying to save a Site or Post in Gutenberg?
- wp_handle_upload returns empty error array
- Gravity form Load By Ajax Cannot Submit – Error 400
- eventON plugin AJAX call triggers website crash
- contact form ajax empty response error message
- How to make registration form ajax?
- Register Template
- change wordpress pagination url after doing the request
- WordPress POST AJAX call, var_dump($_POST) NULL and AJAX response empty when inside ob_start
- WordPress 403 error on form submission with Ajax
- admin-ajax.php 403 errors – no caching, permissions are fine
- Registration form AJAX check for existing username (simple version)
- Syntax error on query_vars while handling with Jquery
- how to get password from user instead wp-generate-password
- While doing ajax, WordPress returning internal server error 500 and stating that my theme functions are undefined
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- JavaScript implementation of Gzip
- How to cache json with wp-super cache
- WordPress AJAX with Axios
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Get Previous & Next posts by Post ID
- Nonces and Cache
- REST API endpoint for elasticpress autosuggest
- ajax – why multiple calls to wp_create_nonce() return same value?
- AJAX request on the frontend always returns 0 if user is not admin
- Using ajax on categories and wordpress loops
- Cannot load admin-ajax.php. No access-control allow origin*
- How to modify wp_ajax function?
- Nonces and Ajax request to REST API and verification
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- wp_remote_get() to get AJAX url /wp-admin/admin-ajax.php
- Can’t seem to get wp_localize_script to work
- Ajax – gettext without a plugin
- WordPress AJAX calls not detecting language properly?
- AJAX issue – Uncaught SyntaxError when processing Zip File
- wp_verify_nonce doesn’t return true on server when it matches the nonce
- update_user_meta doesn’t work with AJAX
- Ajax stops working when logged in?
- WordPress ajax get content post id
- Using wp_handle_upload and media_handle_sideload with ajax
- Create Page With wp_insert_post() and AJAX
- Load ajax if is_home()
- How to know what page is calling admin-ajax.php?
- Populate a Map at The Same Time as showing Posts via AJAX
- wp_localize_script not working on ajax response
- Get wp_title wp ajax
- Why Does WordPress not output admin-ajax.php path by default?
- Code run fast on a cronjob but slow with a do_action or ajax call
- How to export custom database data to excel file
- Ajax comment form submit on frontpage alerts success but no insertion
- How to update Comment post meta through an Ajax call
- ModSecurity && Admin Ajax: Server locking up
- Wp mail does not work when Ajaxed to
- MySQL select query with ajax
- Bad request 400 from custom ajax call
- Use WP admin AJAX url to hide API key
- Get response for check_ajax_referer
- WordPress ajax-action how to return content
- Custom Login with Ajax not working with IE
- AJAX jQuery post frontend returning failed to load resource status 400
- ajax form is returning the dreaded “[HTTP/1.1 400 Bad Request” and a zero
- How to check nonce lifetime value of plugins?
- How can I wp_send_json data?
- Making POST request with AJAX returns a 400 error (without jQuery)
- Front end theme options ajax returns 0
- PHP session when called wp_ajax_nopriv
- Use AJAX in a WordPress Plugin to Get Data From Custom Database?
- Custom RPC end-point security best pratice?
- AJAX – SHORTINIT set to TRUE returns blank
- How to make image in TinyMCE clickable
- How to use Jeditable plugin with admin-ajax.php?
- Ajax mousedown call getting “cancelled” when clicking link
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- Disabling ajax code that does a POST request that ends in a 400 error code
- Add Server Side validation in Ajax mail form
- How to prevent my external API call from being called by anyone but me (my site)
- Ajax not sending the data correctly- Multidimensional array
- get a bad request 400 on my ajax-admin.php file
- All WordPress AJAX calls always return 0
- Trigger action via button
- Want to send ajax request in wordpress to a custom file in plugin
- How to send the checkbox value to email
- Same query in category.php and in function.php, but different result
- Sending email with wp_email and AJAX
- How to use nonces for frontend AJAX voting if the page gets cached?
- AJAX Call in Plugin Returns More than JSON
- Ajax Form seems to post, but does not return
- Why can wordpress not find the actions I add in my constructor?
- delete attachment for one post without deleting actual attachment post
- Memberpress isn’t cooperating with WooCommerce
- where does my function output from load-* go?
- wp_editor() in content that was loaded with ajax [duplicate]
- Facebook Pixel + WooCommerce + AJAX = Confusion
- $wpdb Ajax not redirecting to main page
- wordpress ajax bad request 400
- Custom WP rest api endpoint only working on non https?