ok so i am trying to use HoverCard on my website for the users that are registered on my site. how to i manage to get the data off the database using PHP and sending it to my jQuery script?
i know how to get data from PHP using jQuery but for some reason it is not working. Here is my code:
jQuery code:
var user = null;
$.post('userjson.php',{},
function(output) {
user = output;
});
$('#loggedUser').hovercard({
showCustomCard: true,
customCardJSON: user
});
PHP code:
$username = $_COOKIE['username'];
$user_select = mysql_query("SELECT * FROM users WHERE username='$username'",$con);
$user_array = mysql_fetch_array($user_select);
$user = array(
'name' => $user_array['username'],
'bio' => $user_array['bio'],
'image' => $user_array['propic']
);
echo json_encode($user);