if(!isset($_GET['t'])){$table = 'notes';}
else{$table = $_GET['t'];}
$cats = $table . '_cats';
include 'test.php';
test.php
test(); // works fine
if(isset($_POST['fn'])){
$_POST['fn']();
}
function test(){
global $cats, $table;
echo $cats;
echo $table;
}
js
$(document).on('click', '.atitle', function(){
$.post('test.php', {fn: 'test'}, function(data){
console.log(data); // empty
});
});
I'm expecting$cats and $table written in console
Any help?
testin$_POST['fn']? please check firstecho 'lorem'inside fn test - worksinclude 'test.php';?echo "$cats , $table"; exit;a_notes.php