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
- PHP “php://input” vs $_POST
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- How to add to cart via AJAX Woocommerce [closed]
- How to override WP_DEBUG for Ajax responses?
- Call to undefined function add_action()
- Including WordPress in RESTful API
- Registering AJAX callback function that is part of a class without instantiating the class in function.php
- How to tie built in AJAX to an add_action?
- Refused to execute script from ‘***’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled
- Ajax form submission from admin panel
- AJAX call using admin-ajax URL is returning 400 bad request
- Register new user and add custom data row value for it
- Ajax with OOP doesn’t work
- Error 400 bad request using admin-ajax.php
- Setting TinyMCE Content in wp_editor
- WP Ajax Action Not Picking Up Query String Parameter
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- How to use wp_send_json_error?
- Can I fire an add_action hook inside of a function that recieves data via wp_ajax?
- Force redirect not logged in user to (wp-login.php or wp-admin) for specific page
- How to insert a record by clicking on the link using AJAX
- WordPress Ajax Not Working ( Custom Admin page)
- WordPress ajax success response
- Admin WP List Table Columns Missing
- Loading comments in ajax – comment-reply function missing $args
- Woocommerce update product price via AJAX
- How do I query posts by a sub value with the API?
- Popup or admin/update notice on post/page edit screen without page refresh
- WordPress Integration with Google Groups
- Enqueue script in plugin is not working
- Single page site + pushState?
- Best way to use ajax front-end?
- Ajax calls from the theme directory
- How to pass parameters from jQuery ajax into PHP function?
- ajax is returning 0
- How to add ajax url to js using wp_add_inline_script()?
- use jQuery.load() to include a php file in a div, wp_query() is part of php file
- WP AJAX post filter > do something with empty value
- How to make a fetch() POST request to wordpress rest api?
- How to jQuery Ajax show new data from successful insert?
- Redirect after saving form; and yet use wp_die()
- ajaxt returning object object [closed]
- Load more posts (Ajax) in tabbed sidebar on single.php
- Something strange with ajax
- admin-ajax.php returns 0 even when the post status code is 200 OK
- Why is the file not uploading to the server?
- Get localize of a loaded javascript
- is there’s a way to get the next page content generated by page break block with ajax call?
- REST public POST giving 403 forbidden nginx
- Query data after an Ajax insert
- How to get next and previous post into ajax formed modal windows?
- Passing value from select form with Ajax not working
- Sending email through Ajax without page refresh hangs on admin_ajax.php
- GET request return value as error instead of success
- Content including hooks inside wp-settings.php are being called twice in WordPress
- Problem when sending file via ajax
- wp_verify_nonce not working on the mobile device
- Frontend AJAX Media Upload returning 404
- JS global variable doesn’t update
- 404 error custom post type rest api
- Change button text after ajax db update
- How to implement AJAX within a class storing shortcode atts as class variables
- Jquery wrap permalink in a data-attribute?
- How do I display posts of a specific day?
- (Frontend AJAX) get post data WITH image thumbnail?
- Load .php file into div using ajax
- Native WordPress Video Shortcode Not Working After Post is Loaded via Ajax
- Ajax Function call is always returning 0 in front end(without plugin) [closed]
- Ajax live search, “No products found” when the title contains apostrophes and quotations
- Add Ajax loaded posts to existing posts
- Using AJAX for dynamic settings pages
- Speeding up admin-ajax.php
- admin ajax is not working for non logged in users
- Change search to outpout category name instead of Post type name
- ‘Dehighlighting’ navigation once clicked
- wp_localize_script not create variable in head section
- AJAX admin Internal 500 error Failed to Upload
- Class property not visible inside ajax callback function?
- wordpress ajax bad request 400
- How to stop a nonce from being cached in an inline script, or alternatives to regenerate it if expired?
- JQuery UI Autocomplete/Autosuggest WordPress