Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a onclick="show_trend()" >Trend</a>
- function show_trend() {
- // This does the ajax request
- $.ajax({
- url: ajaxurl,
- data: {
- 'action':'render_admin_charts_page',
- },
- success:function(data) {
- // This outputs the result of the ajax request
- console.log(data);
- },
- error: function(errorThrown){
- console.log(errorThrown);
- }
- });
- }
- function render_admin_charts_page() {
- ?>
- <div class="wrap">
- <div class="em-bookings-events">
- <h2><?php esc_html_e('Event Booking Report','dbem'); ?></h2>
- <?php em_bookings_events_table(); ?>
- </div>
- </div>
- <?php
- }
- add_action( 'wp_ajax_render_admin_charts_page', 'yourfunction' );
- function yourfunction() { ?>
- <div class="wrap">
- <div class="em-bookings-events">
- <h2><?php esc_html_e('Event Booking Report','dbem'); ?></h2>
- <?php em_bookings_events_table(); ?>
- </div>
- </div>
- <?php // Handle request then generate response using WP_Ajax_Response
- }
- jQuery.post(
- ajaxurl,
- {
- 'action': 'render_admin_charts_page',
- },
- function(response){
- alert('The server responded: ' + response);
- }
- );
- add_action( 'wp_ajax_render_admin_charts_page', 'yourfunction' );
- function yourfunction() { ?>
- <div class="wrap">
- <div class="em-bookings-events">
- <h2><?php esc_html_e('Event Booking Report','dbem'); ?></h2>
- <?php em_bookings_events_table(); ?>
- </div>
- </div>
- <?php // Handle request then generate response using WP_Ajax_Response
- }
- jQuery.ajax({
- url: fav_url , // path of that file
- type: 'GET',
- timeout: 20000,
- error: function(){
- alert("Error loading user's attending event.");
- },
- success: function(html){}
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement