I partially stole this answer from SO
$("#idForm").submit(function(e) {
var url = "path/to/your/script.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: {
form1: $("#idForm").serialize(),
form2: $("#idForm2").serialize()
},
// serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
So basically you prevent the normal submit of your forms, serialize it’s content to json and send that in an ajax call to the server.
Related Posts:
- Disable submit button order
- How to load wp_editor via AJAX
- Getting a custom Gutenberg component’s state from outside that component
- How do I only load a plugin js on it’s settings pages?
- How can I change my javascript after it has been enqueued? [closed]
- What happened to convertEntities?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- How do I use WordPress PHP functions in my Javascript code?
- How can I make the “Preview Post” button save and preview in the same window?
- How to avoid redefining requirejs in plugin when another plugin also uses requirejs
- Difference between register_block_type & wp.blocks.registerBlockType
- Can I share predefined fonts from theme_support with a gutenberg component?
- How do I store information in a dynamic block in WordPress?
- W3 Total Cache: Load CSS asynchronously for better PageSpeed score? [closed]
- Pass a php string to a javascript variable
- Problem in loading javascript in footer
- add mediaelement.js plugins into WordPress video player control bar
- Shortcode button dosent work for all posts. Work for first post only
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- React JSX in WordPress Plugin Development
- Internationalization autocomplete JS variable
- How do I create a custom add media button modal?
- Is there an earlier hook than login_head or login_enqueue_scripts?
- Can someone please tell me what is wrong with my plugin?
- Scripts at the end of the page
- Enqueue WordPress plugin scripts below all other JS
- Can I use custom CSS and js plugin to put JavaScript in to validate my forms
- Time consuming callbacks in customizer
- Executing Javascript when a New Post is Published
- Set featured image using javascript in post editor
- Display encrypted content on my website
- How to edit content before post update
- Trying to create a private area custom for each user where they upload images to a server [closed]
- Advanced AJAX Page Loader ignores other JS code
- Add custom JavaScript that is a combination of CDN/uploaded files and easily-edited code?
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- Using TinyMCE in plugin?
- AJAX on Front-End Button Click not working – Custom Plugin
- Deactivate JS Script in Plugin Shortcode
- Remove / overwrite some functions in buddypress.js
- how to insert a HTML form into a javascript popup?
- Display a consistent Google Plus icon on ALL pages of my site
- Add type to enqueued script inside plugin
- After updating the WordPress getting a syntax error in the console
- Skewed / slanted button within elementor [closed]
- How to generate an all in one WordPress New content, plugin and theme update report on a website? [closed]
- get specific value of a array | PHP
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Convert to shortcode?
- Conditional custom redirect
- Meta slider plugin only works after first refresh – Object has no method ‘flex slider’
- Load CSS files in header of Bones theme?
- How to enqueue some javascript source once per page
- JS Plugin not executing the js correctly. Trying to make all internal links scroll smoothly
- Call javascript functions from each page
- Javascript from Easy-Fancybox place into footer
- Share buttons Facebook Twitter, just like wordpress.com without webservice
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- How do I minify a plugins CSS/JS code?
- Directorist – Dropdown doesn’t open
- Javascript fetch on wordpress plugins not working
- Jquery POST Ajax Return null data in wordpress
- How to apply to hide TinyMCE (wp_editor) on button click
- Upload Javascript and json webpage to wordpress
- Stop a script on a single page
- Validating ajax search
- Overriding inline !important CSS with Javscript code snippet with media query
- Add style to body based on url
- Ajax Call not Working in Plugin
- How to create a custom block in Gutenberg with multiple checkboxes?
- Website always load twice on start
- How to add defer to WordPress Plugin javascript? [duplicate]
- Multiple image selection custom widget
- Execute inline javascript in wordpress after page fully loaded
- Javascript inserted from Plugin pointing to wrong location
- How to execute certain code on back-end button press?
- How to solve Blocked a frame with origin from accessing a cross origin frame error in wordpress?
- Speeding up WordPress on a Local Network
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to pass value from WordPress to Javascript
- Number format in thousands on highcharts in wpdatatable plugin
- Disqus comments count taking long to update
- hide load more button if there are no posts left to display
- Embed Javascript code to registered users only
- Best use adding user generated JS/CSS to a theme with a plugin
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- Ajax, jQuery and WordPress
- How do I output user_registered time in my correct timezone?
- Ajax in Plugins: returns the whole page
- Move specific javascript to the footer
- Load css classes after using ajax calls
- Eliminate Render blocking CSS?
- How to make a rest style plugin?
- How do I put a word-press blog into my static site without installing wordpress on server?
- How can i add a random redirect button in wordpress? [closed]
- How can I include properly javascript files in my wp plugin [duplicate]
- Adding a script & php to functions.php
- Beginner question: Accessing js script in plugin
- Select posts from list and add them in a new list