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
- Does a wordpress custom plugin is fired by default on php theme ajax request?
- javascript datatables in a plugin
- Fatal error: Uncaught Error: Call to undefined function get_option()
- Create custom HTML/JS app inside page
- Use just a shortcode from another page
- Force HTTPS 301 redirect with hook
- Hide shortcodes “code” when using the “editor” the same as wordpress do with “gallery”
- I have 2 plugins using the same wp_login action hook and one is not working
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- Add a new confirmation page before saving
- how to get context information inside my funcion
- Plugin – Make sure jquery is loaded in my settings page plus my JS file
- jQuery in WordPress Plugin
- use of do_action() without any functions attached
- How dynamic action login_form_{action} is working
- What happens when two or more plugins use the same hook?
- 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()?
- Does admin_print_scripts-$hook_suffix work for nested paths to individual files?
- AJAX form post returns 0
- How to get all queries’s results after they have executed?
- Update Data parameter of a wp_localize_script() call
- WP Plugin Running before jQuery
- wp_localize_script is not adding a global variable for javascript
- Plugin uninstall function is not working
- Bug: Post needs to be updated twice when adding action for save_post hook
- should i be checking for jquery before enqueing it in a plugin
- Can’t get AJAX call working in custom plugin
- Bad Request in AJAX
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- 400 Bad Request, in wordpress theme development, wp_ajax
- flush rewrite rules after plugin update?
- When does save_post hook fire on post save/update
- jQuery instantly executes (a button click and css change) on load
- Plugin does not add action
- Ajax is not working in a loop
- Remove an action by extending class and replacing it
- How to include jQuery into my plugin so I can use it on plugin page?
- ajax recursive calls on wordpress returning answers outsite the function scope
- Add child pages to submenu automatically
- Are there any security risks when submitting data-attribute data through AJAX?
- After plugin activation hook
- How to replace default comments with custom HTML?
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)
- How can I create a custom plugin that allows anonymous users to signup without registering?
- hook filter after the_content on a specific page
- Bind a function with its own argument to show something dynamically after every content
- how to get the post id in plugin
- Jquery was not found on this server
- Is there an admin hook that will let me read GET variable before it’s too late to set the header Location
- How to enqueue scripts in right way in a plugin?
- How to get error object returned by wp_create_user
- Plugin AJAX Save to Custom Table
- Why enqueue styles on hook?
- What’s the hook for filtering every texts of site?
- making a plugin that moves other plugins wp_head actions to wp_footer
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- Associate multiple email addresses with the same user account, so they can log in with either
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Run command “composer install” when activating wordpress plugin
- Update variable value via add_filter
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- Need help about understand api, wp, $ syntax in WordPress plugin script
- Add a check box in Menu Settings
- Custom filter not working
- 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)
- Insert Into Post Not Working For Audio File Using jQuery