This is my code:
<?php
$steamids = '76561197960435530';
$APIKEY = MYAPPKEY;
$steamAPI = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?steamids=$steamids&key=$APIKEY&format=json";
$json_object= file_get_contents($steamAPI);
header('Content-Type: application/json');
echo $json_object;
?>
I get everything what I need when I go to this info.php
file.
But how should I jQuery parse this JSON response ? I would like to do something like this:
function steamFunction(data){
$("#userinfo").html('<img src="' +data.response.players.avatar +'">');
}
Is it possible somehow ?
This is my jQuery code:
$(document).ready(function(){
$.getJSON("/info.php", function(json){
$("#userinfo").html(json.response.players.avatar);
});
});
I'm not getting any errors but the image wont appearing. Also when I alert this I get undefined