Just saw it… …in your HTML, take the action out entirely. We’re not using the HTML to tell the form/submit button what to do, we’re using JS/AJAX for that.
<form method="POST" action="<?php echo admin_url('admin-ajax.php'); ?>" id="modal-form-ajax" autocomplete="off">
Should become:
<form method="POST" id="modal-form-ajax" autocomplete="off">
Also, instead of targeting the form, target the submit button, so the following:
$("#modal-form-ajax").submit(function(e){
e.preventDefault();
Should become:
$("#submit-btn").on('click',function(e) {
e.preventDefault();
Related Posts:
- WordPress Ajaxifying not working properly
- WordPress Custom wp mail template return full template
- Use AJAX in shortcode
- Display random categories on the front page (Finding and Editing Theme Functions)
- How can I get $id variable in widget’s form function?
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- AJAX handler throws 400 (Bad request) – why?
- How to call WordPress functions from a form processing script
- what is the meaning of settings_fields()
- Removing Unnecessary Text from Admin Menu without CSS
- Set default options for inserting media
- Default or Preset Content for Custom Post Types
- update_post_meta for custom field not working upon form submission
- Remove tag on my RSS Feed
- Display WordPress Search
- How can I rename the WordPress AJAX URL? [duplicate]
- How to add a rel attribute to images that contains their categories?
- Preferred Use of home_url()?
- How to add default images into theme customizer image control?
- How do I call wp_mail from HTML?
- Delete pages and Create default pages for all new network sites
- Actions according to image type and size
- Post thumbnail relative link and HTML modify
- Refactor create_function
- How would go about if I just want a temporary function?
- Remove the deleted users avatar from list
- How to call custom function from functions.php in site-wide template files?
- str_replace function in theme
- Ninja form Redirect depending on text field content [closed]
- Ajax posts filter by date, comments, top views, top likes
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Right way to update widget on dynamic new input field
- How to customly read JWPlayer’s “Playlist” items by using its “playlistid”?
- Hard-coding custom menu elements for menu manager
- Twentyten Child Theme: header images display messed up in admin panel
- How to store data from multiple forms using ajax and php
- IF Statement on Button to make it complete and “uncomplete” based on user action / click
- Gravity Forms Button Text
- When sale price is 0.00 show only regular price
- How to know which ajax file or function is called for action
- Insert image in WordPress with HTML5 tag and caption function
- Multisite Ajax serialize return error [object Object]
- Create post using Ajax
- Move Custom Fields on General Settings Page to New Location
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- WordPress listen to $_POST in functions.php
- Load Post into DIV with Ajax
- wordpress use single ajax in place of multiple ajax requests in a smarter way
- AJAX error handling for submit function in functions file
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Custom HTML markup
- Use a shortcode to display custom meta box contents
- Create custom function for hero image
- How to append classname to body tag if guest user
- Where do I go to edit this area? [closed]
- processing form data with ajax
- Email Exists ERROR into Ajax registration form
- Function to replace comment’s accented characters before posting
- Ajax resetting my global variable
- Linking Javascript in functions.php file
- get content from page through AJAX
- Get URLs for AJAX Filter Checkboxes WordPress
- Detect Ajax call inside pre_get_posts function
- How to replace ACTION url from original wordpress login form?
- Ajax Form Issues using Lightsail (AWS)
- Save_post – Warning: Cannot modify header information
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- Modifying a WordPress Plugin
- External api call and make global variable for any page visitor enters , page-home, page, single etc
- WP AJAX Request Not Working
- CSS style and app.js not loading
- Ajax in plugin fails – but only on one blog – no idea why
- Attend event form with ajax
- Parent category as WOOCommerce Categories widget title
- How would I correctly implement a new if statement in a child functions file?
- Multiple Notifications SetInterval
- Function stops working
- Remove all video attachment, both files and post/postmeta from database?
- admin-ajax.php 403 forbidden only when calling from external file
- True email confirmation for registration (keeping unvalidated users from user table)
- How To Show Shortcodes In WordPress Custom Fields?
- How to create admin ajax function for my contact form
- admin-ajax.php & my wp-admin folder url showing in header
- wordpress function through ajax not being called
- wordpress ajax is not working for dropdown selection
- Updating site content after an AJAX call without a page reload
- Error function main() is a non-object to construct my Ajax.php
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- Get Value of Custom Field
- restrict access to specific urls on a specific period of time
- How to request login for user but not for bots
- Ajax call does not work for this custom code
- ajax form function error
- How do I add functionality to images?
- AJAX values converted to PHP Variables?
- How to crop image in WordPress with aspect ratio for any size of image
- Get all users from role and add to dropdown (select) – wordpress, javascript
- iOS and ajaxComplete
- Customizer cuistom CSS Priority ordre Issue
- Copy and Modified WooCommerce function is_coupon_valid [closed]