i have two pages in my wordpress plugin
- index.php
- charts.php
in index.php i have some content and some link..
<a onclick="show_trend()" >Trend</a>
while clicking this link ,i have an ajax function to create content in charts.php(i dont know if it is correct way)
function show_trend() {
var data ="action=render_admin_charts_page";
jQuery.ajax({
type: "POST",
url: "../wp-admin/admin-ajax.php",
data: data,
dataType: 'json',
success: function(data) {
alert(data);
//here i want to create html content
}
});
}
andfollowing is my php function and hook
function render_admin_charts_page() {
?>
<div class="wrap">
<div class="chart">
</div>
</div>
<?php
die();
}
add_action( 'wp_ajax_render_admin_charts_page', 'render_admin_charts_page' );
now i am getting 0 as alert .
render_admin_charts_page
function?