i've done an ajax request in my wordpress plugin.My request is based on steps below:
1) i am including js file and starting a request document on ready
2)At the php side i want to take this request and print it to test.
for all these stuff i wrote these codes:
main.js:
$(function(){
$.post('/wp-content/plugins/dsn/functions.php',{token:"1tibu4"},function(data) {
console.log(data);
},"json");
});
functions.php:
<?php
add_action('loop_end', 'init');
function init(){
global $_POST;
$post= $_POST;
echo json_encode($post);Exit;
}
My question is when request complete there is nothing on the response tab of console screen.How come this happen?