I see two things. You’re missing an action call – you need
add_action( 'wp_ajax_render_admin_charts_page', 'render_admin_charts_page' );
add_action('wp_ajax_nopriv_render_admin_charts_page', 'render_admin_charts_page');
Plus, from looking at your render_admin_charts_page()
you need to change your json dataType to html. Your charts function is outputting html so all you need to do is output it; your alert()
should contain all the html from your function.
One more thing, if this is still a live question, why die()
in your render_admin_charts_page()
function? That function prints a message so that could also be messing with your returned value.
Related Posts:
- ajaxurl not defined on front end
- Get returned variable from a function to add_shortcode function
- Using Ajax call in jQuery doesn’t work in widget
- Admin-ajax.php appending a status code to ajax response
- Ajax in WordPress – path issue
- WordPress Ajax callback function from plugin – OOP
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- how to search users by ajax live search
- template_redirect or admin-ajax.php?
- WordPress custom taxonomy check box to dropdown
- jquery & ajax sending data to php
- Ajax submit result opens in admin-ajax.php
- insert query on a custom table using ajax with jQuery plugin Jeditable
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- WP ajax requests not stacking?
- ajax working when function is on child theme but not in plugin page
- Get cat parameter from admin-ajax
- Ajax on the Administration Side of plugin – returns 0
- Jquery php request is returning a weird result
- WordPress Ajax not returning Response
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Filterable posts using categories
- How to get values from Tinymce visual editor popup?
- replacing jquery google cdn with a new version dynamically
- WordPress function is not called and ajax return 0
- Ajax call not working with
- Template file structure , wordpress hook for altering the template
- Page reload occurs before request finishes
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- How many times will this code run? (or, how rich is grandma?)
- add_action hook for completely new post?
- How to include jQuery and JavaScript files correctly?
- How Do I Use jQuery UI In My Plugin
- How can I run AJAX on a button click event?
- WordPress Hook for user register
- Test to see if jQuery or Prototype is queued by another plugin?
- Using filters and actions for plugin API?
- Empty POST data on server on AJAX request using Angular $http
- jQuery in header or footer
- wp_localize_script $handle
- Help adding image upload functionality to widget
- How to check if certain plugin exists and in expected version
- Built in admin ajax hooks?
- Is it possible to modify the media library admin screen?
- What function to hook for changes made in status and visibility of a post
- Hook to get image filename when it is uploaded
- How to delete an user including data from custom database tables
- Should action callbacks start with a verb?
- Execute Hook on the footer or header after activating a plugin
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- What filter should I use to insert a button inside on Media>Add New
- How to use a hook to override an update_post_meta call in a plugin?
- External Authentication, session_tokens not destroyed on logout
- Woocommerce checkout update totals with datepicker
- Including the necessary functions for a custom ajax registration form
- correct way to call javascript into hook function
- Dashboard – get status and position of metaboxes and pass them to ajax method
- Ajax contact form widget plugin data not insert in database
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- Storing data in wordpress database from ajax call from different website
- javascript datatables in a plugin
- Force HTTPS 301 redirect with hook
- Hide shortcodes “code” when using the “editor” the same as wordpress do with “gallery”
- use of do_action() without any functions attached
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- Plugin uninstall function is not working
- should i be checking for jquery before enqueing it in a plugin
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- jQuery instantly executes (a button click and css change) on load
- Hook add_attachment error
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- hook update_option/updated_option empty $old_value and $value
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- Save user total active time after login in wordpress [closed]
- AJAX call to admin-ajax.php by subscriber returns home page
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Ajax function is not working on WordPress
- Workflow for new importer plugin – your advices?
- Use options to control jQuery plugin
- sanitizing/escaping plugin options
- Using jQuery prepend() with file include
- How to do admin ajax request in a plugin for rest api
- Ajax action has 200 status but response of No response data available for this request
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- jQueryUI draggable doesn’t work in WordPress plugin
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Rate limiting ajax requests in WordPress
- WordPress Ajax request “Failed to load resource: the server responded with a status of 400 ()”
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- How to handle ajax Request in a complex-structured plugin?
- Add_action not calling callback function
- PHP includes with AJAX actions
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- add_option_{$option} action hook not being called
- Multi hook deploiement
- woocommerce single product page hook not working
- Insert plugin html content to a specific spot in the frontpage
- get_term_by() returning null on plugin
- wp_head is not fired from the hook I have used in my plugin