Have a read of AJAX in Plugins, then see if you can adapt this code to what Highcharts is wanting:
add_action('wp_ajax_wpse_77392_get_json', 'wpse_77392_get_json');
add_action('wp_ajax_nopriv_wpse_77392_get_json', 'wpse_77392_get_json');
function wpse_77392_get_json() {
global $wpdb;
$sql = "
SELECT `date`,`value`
FROM {$wpdb->prefix}table_name
WHERE `date` BETWEEN '2011' AND '2012'
ORDER BY `date` ASC;
";
$results = $wpdb->get_results($sql);
$json = json_encode($results);
header('Content-type: application/json');
echo $json;
exit;
}
Related Posts:
- AJAX in plugin wp_send_json() sending html
- Create WordPress posts from JSON array using plugin in admin
- Call Ajax URL in Plugin
- In a plugin, How to update a json file using ajax
- How to use Datatable with Ajax when creating plugin on WordPress?
- Ajax specific template not loading in replacement of index.php
- Plugin Admin Page Ajax-Admin call returning 0, URL set correctly. Implemented localized scripts but did not fix it
- WP Rest API: details of latest post including featured media url in one request?
- How to load wp_editor via AJAX
- How can I pass a variable to wp_ajax action?
- Loading shortcode with ajax
- Add image to post from external URL
- WordPress wp-json API – Custom Post Type returns 403
- How to add a sub menu with AJAX?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- Execute a function using ajax
- Problem running Ajax in WordPress
- What’s the point of using WordPress’s built in admin-ajax.php?
- 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 gives 400 error
- Why plugin ajax response is -1?
- WordPress Ajax Callback
- plugin ajax to external php file always return null
- 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
- When to use action hooks and plugins
- Simple ajax call not working in wordpress plugin
- WordPress JSON API remove posts from a specific category
- Form isn’t inserting data into database with ajax plugin
- What’s the best way to implement AJAX in WordPress?
- How to put JQuery/Ajax inside shortcode?
- __callStatic method handler passed to add_action causes bug in PHP
- How to display the “ratingValue” and “ratingCount” values generated by the KK Star Ratings plugin into my page’s recipe ld+json schema
- How to use JSON data from URL into table on my wordpress website
- jquery not calling php function
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Ajax with plugins returns 0
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- Using AJAX to generate front end / viewer end pages
- Post Comments with Ajax in WordPress
- WordPress api call using wp-ajax returns error 400
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- Render Modula Plugin Shortcode On Ajax Request
- AJAX on Front-End Button Click not working – Custom Plugin
- How to handle WordPress Plugin Front-end AJAX Call [duplicate]
- AJAX Load more start with x posts
- Is it safe to use admin-ajax.php in the frontend?
- WordPress front end AJAX. Return 0 :?
- How to do the simplest possible frontend ajax call from a plugin?
- Using custom php file for ajax url inside plugin
- Asynchronous request in wordpress
- How do I localize admin-ajax.php that is used in Ajax Load More – Infinite Scroll?
- Ajax object not defined – JS file is in plugin folder
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- WordPress subfolder installation AJAX Problem
- Calling a class method instantiated by ajax call in wordpress [closed]
- Loading by Ajax a plugin that also uses Ajax
- How to call php file in theme directory from plugin
- Upload Javascript and json webpage to wordpress
- How can I adjust my function so the page editor still loads in the backend?
- Error datatable whit ajax
- Facing Problem with admin-ajax.php URL – Getting 404 with AJAX call
- Trouble with AJAX using GET
- WP Ajax DB issues
- Calling PHP function with AJAX
- jQuery Ajax not loading page with ACF fields
- WordPress output data to another website and pull data
- How achive serving multiple concurrent Ajax / Rest calls in plugin?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Overwriting Plugin’s Ajax callback function from theme
- API page return Header 500 but Work
- cURL do not mimic click
- admin-ajax.php not working properly on subdomains
- My ajax request don´t work and return 0
- Populate select option with JSON file
- Plugin with AJAX on subdomains causes 404 in console
- WordPress update plugin through Dashboard/Plugins displaying error
- How can I use wp_ajax_response for front-end error reporting?
- JSON Feed on my wordpress Blog
- display user input using ajax in wordpress
- Ajax, jQuery and WordPress
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- Contact Form loaded with Ajax
- How to load a plugin when doing an Ajax call? [duplicate]
- WordPress plugin ajax post parameter
- admin panel save option with ajax
- Capturing POST data
- Pulling Advanced Custom Fields from other pages
- Response from Php File to Ajax is not getting sent
- Load css classes after using ajax calls
- How to make a rest style plugin?
- WordPress portfolio pagination on home page
- wordpress Ajax success doesn’t return the value
- Ajax button “Load more” is not loading correct language version posts for logged out users
- Inline AJAX script passing variables to PHP
- wordpress admin-ajax bad request 400