You can change the form action to admin-ajax.php?action=your_action
and this will work, but it’s not best practice.
The ajax submition should be added via javascript, not by changing the form action (also your js function should prevent the form from submiting normally, returning false – see here an example: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/), and php handling of the data (on the page the form action is poing to) should be present as fallback.
Related Posts:
- How to HTML5 FormData Ajax
- Admin Ajax and HTML5 Formdata
- How to display contact form 7 form in vanilla js without jquery in frontend
- Refresh Gutenberg with JS for it show updated post
- Ajax show custom post data form & script
- Bad Request when adding new post via ajax form
- jQuery AJAX submit form
- JavaScript implementation of Gzip
- jQuery’s .on() method combined with the submit event
- Is there a JavaScript API? How to access public and private data in JS?
- Nonces and Cache
- admin-ajax.php doesn’t work when using POST data and Axios
- Custom Form with Ajax
- ajax – why multiple calls to wp_create_nonce() return same value?
- Admin Notification after save_post, when ajax saving in gutenberg
- Custom PHP endpoint for a plugin’s AJAX call
- How to link WordPress heartbeat to ajax form
- Refused to execute script from ‘***’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled
- WordPress Ajax Login without page reload
- Ajax form submission from admin panel
- Is there a hook that fires before an ajax call?
- Dynamically changing navigation links (next and previous) via AJAX
- Drag and drop multiple file upload using Ajax WordPress
- Vue.js + AJAX Shortcode
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- wp_ajax action is not running
- Confused on AJAX submit form through page template
- how to use reCaptcha v3 in wordpress custom login form?
- admin-ajax.php HTTP400: BAD REQUEST – The request could not be processed by the server due to invalid syntax
- AJAX issue – Uncaught SyntaxError when processing Zip File
- WordPress AJAX Call Not Return Result
- Is there a hook to process a backbone restful PUT request inside wordpress?
- Nonces, AJAX, script variables & security in WordPress
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- How to localized one js file for different actions?
- Prevent page reload after ajax form submission
- wp-admin AJAX with Fetch API is done without user
- Can I fire an add_action hook inside of a function that recieves data via wp_ajax?
- Call javascript function when category was added via ajax
- Populating content dynamically via AJAX and Advanced Custom Fields [closed]
- WordPress Ajax Problems
- Woocommerce Ajax Add cart not working
- Using AJAX with Forms
- Show Post Content with AJAX
- Load JavaScript from a post that’s loading into Fancybox via ajax
- Sending variable from ajax on form submit
- How do I query posts by a sub value with the API?
- contact form ajax empty response error message
- Gravity Forms closes my popup on Validation Error [closed]
- Can’t trigger an AJAX function with a submit button in the dashboard
- Specify ABSPATH in jQuery url
- ajax form is returning the dreaded “[HTTP/1.1 400 Bad Request” and a zero
- Hide Load more Ajax button if there is no more users to load or less than the number?
- How to disable drag-and-drop upload function in Media Library?
- Output multi-steps form results in same page
- Making POST request with AJAX returns a 400 error (without jQuery)
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Using get_theme_mod in php ajax form doesn’t work
- Is there a better way to access transients using javascript
- Run javascript upon successfully set featured image
- Get uploaded attachment width & height and attachment ID after upload them
- change wordpress pagination url after doing the request
- Get localize of a loaded javascript
- Updating failed. The response is not a valid JSON response. specific to my browser when I include javascript in my html
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- Refresh checkout fields on add to cart with order bump
- Should wordpress nonce be placed in html form or in javascript file
- Add Server Side validation in Ajax mail form
- How to send automatic response after form submission without plugin
- javascript onClick update user_meta from jquery.ajax
- how to make sure js is enabled before executing php function
- How to Object.freeze wp_localize_script
- ERROR while passing data from JS to PHP via AJAX
- Content including hooks inside wp-settings.php are being called twice in WordPress
- React to AJAX adding to the page
- Using existing ajax data that is loaded into page
- Registration form AJAX check for existing username (simple version)
- Issue developing an AJAX form with WordPress
- Ajax call from Plugin using Class
- How to safely pass post_id and user_id via AJAX to the backend (prevent user from changing it via JS)?
- AJAX form not working, still reloads on submit
- Call public static method from ajax ‘wpcf7_mail_sent’ hook
- Ajax WordPress pass post URLs
- Why function called by admin-ajax executes synchronously?
- Jquery wrap permalink in a data-attribute?
- $_POST empty in using new php file added to theme
- Session variables lost during Ajax calls – WordPress – Sage Starter Theme
- Ajax Form data is not posted back to the get_results()
- Using AJAX for dynamic settings pages
- ‘Dehighlighting’ navigation once clicked
- How do I convince this button to do something when it is clicked?
- Ajax Form seems to post, but does not return
- AJAX admin Internal 500 error Failed to Upload
- Using Javascript Callback from plugin in a theme
- WordPress blocking polling request when signed into Admin
- WordPress Ajax send response on every iteration of a loop
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Escaping admin_url output being passed to js (esc_js vs esc_url)
- How to submit a button automatically after every scheduled hours?
- At what stage does wp_ajax hooks gets applied during WordPress request?