Wrap your javascript code with document.ready, and if it works I would suggest going back to putting this in an external file
jQuery(document).ready(function(){
jQuery('#ajax_form').on('submit', function(e) {
e.preventDefault();
console.log('Here');
var form = jQuery('#ajax_form');
var data = form.serialize();
data.action = 'add_word_to_form'
jQuery.post('/wp-admin/admin-ajax.php', data, function(response) {
alert(data);
});
//return false;
});
});
Related Posts:
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to create popup same as wordpress popup feature
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Load css classes after using ajax calls
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Why is my ajax call refreshing the page?
- How do I use WordPress PHP functions in my Javascript code?
- Admin-ajax.php is dying “0” without processing function
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Check if email address exists front end with AJAX in a plugin
- Best approach to fetch data from wp options to js file or php file
- Ajax contact form widget plugin data not insert in database
- wordpress add_action() issue in ajax call
- Ajax request sends url rather than data
- wc_get_template_part doesnt display the content [duplicate]
- Jquery POST Ajax Return null data in wordpress
- How to properly enqueue jQuery knob on WordPress without conflict?
- Ajax Call not Working in Plugin
- JS working when used normally but not in wordpress
- AJAX update fails for public/non-admin users
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- Overwriting Plugin’s Ajax callback function from theme
- Javascript in plugin not working
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- WordPress ajax not working in registration
- How to get site homepage from plugin?
- get_option include in my adsense
- Ajax in Plugins: returns the whole page
- Jquery post responses 500 error after some time and lastly an 503 error
- How to load wp_editor via AJAX
- How do I only load a plugin js on it’s settings pages?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- How to fetch serialized data from wordpress options
- Execute a function using ajax
- What’s the point of using WordPress’s built in admin-ajax.php?
- How to remove an Ajax action
- Has anyone used require.js for handling plugin scripts?
- How do I store information in a dynamic block in WordPress?
- jQuery Plugin to use WordPress functions in AJAX request
- Ajax gives 400 error
- Pass a php string to a javascript variable
- Problem in loading javascript in footer
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- 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
- Simple ajax call not working in wordpress plugin
- Form isn’t inserting data into database with ajax plugin
- How to put JQuery/Ajax inside shortcode?
- Can someone please tell me what is wrong with my plugin?
- __callStatic method handler passed to add_action causes bug in PHP
- Enqueue WordPress plugin scripts below all other JS
- Time consuming callbacks in customizer
- wp.media javascript issue with on select
- jQuery for custom plugin not working with Divi theme
- WordPress + JavaScipt + AJAX + MySQL: insert query for form
- How to prevent plugins from loading jQuery
- Post Comments with Ajax in WordPress
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- WordPress front end AJAX. Return 0 :?
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Asynchronous request in wordpress
- JQuery needs to be defined in , but Gravity Forms is defining it in the
- Is there a better way of handling AJAX requests in WordPress?
- Load CSS files in header of Bones theme?
- 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
- can’t unzip file
- wp_query ‘s’ parameter does not work with WC_AJAX
- Error datatable whit ajax
- Overriding inline !important CSS with Javscript code snippet with media query
- WP Ajax DB issues
- Calling PHP function with AJAX
- Add style to body based on url
- jQuery Ajax not loading page with ACF fields
- update_post_meta is not working for me when I use e.preventDefault for update button
- Website always load twice on start
- How to use Datatable with Ajax when creating plugin on WordPress?
- Multiple image selection custom widget
- checkout stripe with plugin contact form
- How to use information from the database in the front-end?
- Filterable posts using categories
- How to pass value from WordPress to Javascript
- Help with customising love it plugin (use within foreach)
- My ajax request don´t work and return 0
- Can’t find variable is_single in my jQuery plugin
- How to Add Jquery FullCalendar in wp plugin in admin
- Hyperlink to execute PHP
- WordPress plugin ajax post parameter
- Capturing POST data
- How do I output user_registered time in my correct timezone?
- Integrating WordPress Content into a jQuery Slider
- How to make a rest style plugin?
- wordpress Ajax success doesn’t return the value
- Ajax button “Load more” is not loading correct language version posts for logged out users
- Select posts from list and add them in a new list