I have a link in worpress page

<a onclick="show_trend()" >Trend</a>

and i am calling an ajax function onclick.

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);
        }
    });
}

what i want to do when calling this function is display a div section .for that ,this is my function

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
}

ajax function is calling but not rendering to div

Read more here: Creating a new div onclick wordpress+ajax


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: