You’re declaring the AJAX handler inside the shortcode handler. That’s not going to work: admin AJAX requests aren’t processed in the context of a page, so the shortcode won’t be run, so the handler won’t be set up.
You’ll need to move the function definition and add_actions out to the top level, not inside wpcode_elementor_shortcode.
Your script enqueues also look wrong too: they’re supposed to be called from a wp_enqueue_scripts hook handler, which will be called before you know whether they’re actually needed on a page – AFAIK there’s no good solution to only including scripts on the right pages. That said, you might get away with that here if the script is set to be included in the footer (which it’s not at first glance) and the dependencies just work out too.
Related Posts:
- jQuery’s .on() method combined with the submit event
- Why use admin-ajax.php and how does it work?
- Why is die() used at the end of function that handles an Ajax request?
- Making my AJAX powered WordPress Crawlable
- Using Backbone with the WordPress AJAX API
- WordPress Ajax Data Security
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
- admin-ajax.php doesn’t work when using POST data and Axios
- Custom Form with Ajax
- How to process ajax requests correctly using ajax plugins
- How do I hook an Ajax request into a PHP callback?
- Gutenberg – how to correctly perform ajax request on backend
- get_template_part execute with ajax
- How to add WordPress nonces to ajax request
- How declare Ajax functions ussing SHORTINIT
- Load custom formatted comment with AJAX: reply link isn’t rendered?
- Is there a way to optimize function that is used for returning data in an ajax-call?
- WP REST API route request explain
- Ajax returning correct data BUT at wrong place
- get_posts empty when called via Ajax
- WP-API and Basic Auth returning 403 on POST but not GET
- Is there a hook to process a backbone restful PUT request inside wordpress?
- Check if username exist with AJAX
- How to localized one js file for different actions?
- WooCommerce: Translation lost on AJAX call in Checkout page [closed]
- Async Loading of Custom Posts
- Call javascript function when category was added via ajax
- How to add WP API and JS featured image attachment
- Using AJAX with Forms
- wordpress and add actions to button by coding
- Get Author Post on author.php with AJAX
- Can’t publish post using ajax
- Ajax in plugin settings page returns 400 Bad Request
- Admin-Ajax Error
- Customizer AJAX using buttons
- WordPress Ajaxify Problem with Scroll-to [closed]
- Stop ajax listener from sending empty parameter to function
- Can’t trigger an AJAX function with a submit button in the dashboard
- AJAX Call is Only Returning 100 Results from Query
- AJAX and -1 response
- How to make custom button link on the WordPress Admin Bar run by AJAX
- Ways to load admin-ajax faster without initializing all plugins?
- is_single() conditional check inside ajax php function
- WordPress action – Pass arguments into action in an AJAX call?
- How can I call an api before user login
- Problems with wordpress nonces in Ajax call
- Get post content and show it in a div
- Output multi-steps form results in same page
- Full Front End, AJAX comment system and comment reply script
- How to get post from pure frontend AJAX (using only post ID)?
- Multiple AJAX requests using the same ajax_object.ajaxurl
- Is there a better way to access transients using javascript
- Ajax not working for certain user roles
- Filter custom post types by custom field using AJAX
- How to perform a frontend HTTP call with AJAX when plugin save the new settings?
- Problem loading ajax in the header
- How to detect if the ajax_query_attachments_args was triggered to set the featured image?
- WordPress ajax response save into database
- How to change request URL?
- Updating failed. The response is not a valid JSON response. specific to my browser when I include javascript in my html
- Automatically refresh div id every 15 seconds with code snippet from .php file
- Zip Files from custom fields
- Prevent AJAX caching from plugin
- Ajax call returning 0 in page template
- If I leave out the wp_die() in the testiframe function I get the ‘0’ appended to my output. If I put it in, the page w/ iframe linked to it crashes
- How to run an ajax call in elementor editor
- ERROR while passing data from JS to PHP via AJAX
- 400 Bad Request – Post to admin-ajax.php
- ajax load more instead of pagination
- How to pass array from jQuery to PHP with AJAX in WordPress?
- Ajax call works for logged in users and returns “Bad Request” for guests [duplicate]
- On form submitting, admin-ajax.php shows status as pending
- How to force the admin-ajax.php file to load over HTTPS?
- Unable to ajax request with meta_query
- Ajax WordPress pass post URLs
- Should I edit a user meta field with PUT, PATCH, or POST and WP::Editable
- How To Pass Theme Path In Javascript Ajax to Pass Id On another Page in WordPress Custom Page Template?
- AJAX action returning empty posts array?
- Cannot add multiple single images at once
- How to send custom variable in Media Uploader ajax request?
- WordPress Ajax JSON success return no being recognized
- Session variables lost during Ajax calls – WordPress – Sage Starter Theme
- WordPress page content only in fancybox except direct click
- Ajax takes 10x as long as it should/could
- While doing ajax, WordPress returning internal server error 500 and stating that my theme functions are undefined
- SHORTINIT and sessions
- How to use AJAX to check if user is still logged-in?
- Ajax navigation and scripts loaded only on certain pages
- Closing ajax function file with die() causes error and empty page
- How to load wordpress sidebar using AJAX [duplicate]
- using Ajax: call to undefined function get_option
- WordPress Pagination with ajax – Dots
- Bad Request when adding new post via ajax form
- Ajax load more posts button
- WordPress Ajax send response on every iteration of a loop
- Access to a data from a response AJAX called in a template file php
- Escaping admin_url output being passed to js (esc_js vs esc_url)
- Uncaught ReferenceError: custom_ajax is not defined
- wp-admin/admin-ajax.php 400 Bad request (chrome console)
- add_post_meta not working within AJAX function