jQuery(document).ready(function(e) {
jQuery('#m').click(function()
{
//jQuery(this).fadeOut();
var d='<?php echo $plugins;?>';
jQuery.ajax({url:d,data:{q:10},type:GET,success: function(msg)
{
alert(msg);
}
}
)
});
I have to develop my own plugin, basically WordPress has an admin-ajax file which handles this type of request, so how can I make it request using its own file to handle an Ajax request?
for that you need to do it like this:
and in your handler file :
add_action( ‘admin_enqueue_scripts’, ‘my_enqueue’ );
function my_enqueue($hook) {
if( ‘index.php’ != $hook ) return; // Only applies to dashboard panel
}
And Do not forget to enqueue your script :