Clientside;
// get user stats
$.post("core/sys/user.php", JSON.stringify({
req: "stat"
}), function (response) {
var json_obj = $.parseJSON(response);
$('#urls').html('Shortened ' + json_obj.urls + ' URLs');
$('#reds').html('' + json_obj.reds + ' Redirects')
});
Serverside;
if($json->req == "stat"){
$stats = $functions->getUserStats($common->getSession('userid'));
$arr = [
"urls" => $stats['urls'],
"reds" => $stats['reds']
];
exit(json_encode($arr, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
}