I figured this out after a night sleep. Sometimes our brains function like that.
The problem was actually my call here, It should’ve been “add_foo” not “_add_foo”
data: {
// the value of data.action is the part AFTER 'wp_ajax_' in
// the add_action ('wp_ajax_xxx', 'yyy') in the PHP above
action: '_add_foo'
// ANY other properties of data are passed to your_function()
// in the PHP global $_REQUEST (or $_POST in this case)
},
Related Posts:
- Get Plugin Information from Multiple Sites Externally
- What’s the preferred method of writing AJAX-enabled plugins?
- How to load wp_editor via AJAX
- I Want to Get A Plugin Version Number Dynamically
- Get a list of all WordPress.org Plugins?
- [Plugin WPML] : How to create a translation of a post using the WPML API?
- Help with 4.6. Attachment response object in JSON API plugin
- What WordPress API function lists active/inactive plugins?
- How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
- Change Page’s Tag Using functions.php File
- Help making my pagination plugin better
- How to build an API as a plugin
- admin-ajax returning 400 error when request is made with Fetch API
- Get Latest Plugin Version from WP API
- How should I use register_setting, add_settings_section, & add_settings_field in my plugin’s options page?
- How can I pass a variable to wp_ajax action?
- Loading shortcode with ajax
- How do I retrieve a list of popular plugins using the WordPress.org Plugin API?
- How to pass JavaScript variable to PHP in wordpress widget?
- Add image to post from external URL
- How to add a sub menu with AJAX?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- jQuery AJAX call not executing in Plugin
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- Using custom code, how can I fetch data from the WordPress plugin repo?
- Can’t use /wp-json/wp/v2/plugins API endpoint even as administrator
- Execute a function using ajax
- Problem running Ajax in WordPress
- Ajax Load More and Masonry: is it possible to load admin-ajax.php in the front end?
- Send Data to WordPress from kiosk
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- ‘Lazy loading’ list of posts with pagination
- Multisite functions to communicate with individual site functions
- Errors while using ajax from external wordpress page
- I can’t access wordpress functions from an ajax php call
- Built in admin ajax hooks?
- How to include admin-ajax when loading external javascript
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- delete_user_meta Delete one value out of array
- How to use wp-ajax in wp-cron
- Calling shortcode in wp_localize_script strips result
- Does the WordPress API have Modal Dialogs
- Why is my ajax call refreshing the page?
- An Unexpected HTTP Error occurred during the API request
- What’s the point of using WordPress’s built in admin-ajax.php?
- Admin-ajax.php is dying “0” without processing function
- how to use ajax to display from database and load more in wordpress plugin
- REST-API: extend media-endpoint
- How to check if WordPress is updating plugins?
- Custom routing for plugins
- Advanced Integration – WordPress + YOURLS
- How to remove an Ajax action
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Ajax with jQuery UI dialog not working
- Shortcode in AJAX popup
- What is the best way to move a plugin´s subdirectory+files to wp-content/uploads-directory?
- Create or Update thousands of woocommerce products via PHP
- Looking for a solution – slightly convoluted problem
- How to add pagination to wpbakery grid?
- How can I process xml file on upload?
- Keep user’s privileges on accessing contents in JSON response
- How can I reuse the WordPress search form for a custom plugin / widget?
- AJAX image upload with a upload progress bar using media_handle_upload
- jQuery Plugin to use WordPress functions in AJAX request
- ajax front-end increment views on click
- $wpdb working with ajax but showing ajax error instead of success
- Why none of the plugins that have ajax doesn’t work in my website?
- Ajax gives 400 error
- Check if email address exists front end with AJAX in a plugin
- Why plugin ajax response is -1?
- Why do plugins that cause ‘unexpected output’ create AJAX problems?
- WordPress Ajax Callback
- Best way to hook a custom url?
- plugin ajax to external php file always return null
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How can I add an options page for my class based plugin?
- Sending WP posts to external API
- WooCommerce get_price returning wrong price when used via ajax
- Shortcode button dosent work for all posts. Work for first post only
- AJAX button run function
- CMB2 Repeatable Group & JSON API
- When to use action hooks and plugins
- Simple ajax call not working in wordpress plugin
- How do I create a custom add media button modal?
- WordPress JSON API remove posts from a specific category
- Form isn’t inserting data into database with ajax plugin
- How to access data in wordpress database externally using php
- What’s the best way to implement AJAX in WordPress?
- How to Create a Custom Panel and Fields in Post Page [Plugin]
- How to put JQuery/Ajax inside shortcode?
- AJAX search posts and pages
- WordPress Ajax Posting from App
- __callStatic method handler passed to add_action causes bug in PHP
- Using a custom plugin to capture input data via Ajax and PHP
- Ajax contact form widget plugin data not insert in database
- woocommerce_package_rates not fired when wordpress woocommerce accessed as non ajax
- Theme is Causing Ajax Conflicts for a plugin I cant identify it
- Why WordPress plugin url ajax doesn’t work?