Quantcast
Channel: Get Gravatar Img from JSON - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Get Gravatar Img from JSON

$
0
0

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?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images