JQuery : Gamertag Info

BinaryX Jun 20, 2013

  1. BinaryX

    BinaryX Lifetime Gold XPG Developer Lifetime Gold
    0/47

    Joined:
    May 21, 2011
    Messages:
    977
    Likes Received:
    257
    Trophy Points:
    0
    Gender:
    Male
    Location:
    Europe
    Console:
    Xbox
    Hiya folks!

    This block of code fetches information on any given gamertag, right now it's live on my site displaying my information (Gamertag, gamerscore,reputation, presence etc...).



    var url = "https://www.xboxleaders.com/api/2.0/profile.xml?gamertag=GAMERTAG"



    $.ajax({

    url: url,

    dataType: 'text',

    success: function(data) {

    var xml = $.parseXML(data);

    $(xml).find("gamertag").each(function(){

    $('#gamertag').text($(this).text());

    });

    $(xml).find("gamerscore").each(function(){

    $('#gamerscore').text($(this).text());

    });

    $(xml).find("reputation").each(function(){

    $('#reputation').text($(this).text());

    });

    $(xml).find("presence").each(function(){

    $('#presence').text($(this).text());

    });

    }

    });


    You will have to make the appropriate fields and edit the code where needed.
    Also note that the other attribs are broken at the moment, might be something wrong with XBL or with https://www.xboxleaders.com (it's where the info comes from, it's an api).

    I just made a short implementation of their api, it can do much more but if i were to make code for all of that it would be a dozen pages and not feeling up for it.

    I tried several different custom api's for a thing like this but theyre all broken so i decided to research a bit on my own.
     

Share This Page

Close