I'm trying to parse data that will display a users Gravatar image. The JSON is the following : http://api.bfhstats.com/api/playerInfo?plat=pc&name=stewartps&output=js On line 34 is 'uGava' which is their gravatar URL. It should be then http://gravatar.com / + uGava
At the moment I have a form which asks for the user to input a name and select a platform.
This is the code I have for that:
$("#playerstuff").submit(function() { $.ajax({ type: "GET", url: 'http://api.bfhstats.com/api/playerInfo?plat='+ document.getElementById("platform").value +'&name='+ document.getElementById("playername").value, //datatype : "json", success: function(data) { document.getElementById("playerrank").innerHTML = '<img src="http://gamingstats.ga/'+data["player"]["rank"].imgLarge +'" />'; $("#formpanel").hide(); $("#dataret").show(); $("#playerimg").show(); } }); return false;});
I also just have a standard Image
<div class="user-img-div" id="playerimg" style="display: none;"><center><img src="img.png" class="img-circle"></center></div>
So my question is how will i use that standard Image to display the users Gravatar from the JSON data?