Skip to content

Instantly share code, notes, and snippets.

@lye

lye/script.js Secret

Created March 15, 2016 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lye/391c77672051b12673c2 to your computer and use it in GitHub Desktop.
Save lye/391c77672051b12673c2 to your computer and use it in GitHub Desktop.
fetching /v2/pvp/stats
(function() {
function getJSON(url, cb) {
var xhr = new XMLHttpRequest(),
baseUrl = "https://api.guildwars2.com/v2/";
xhr.onreadystatechange = function() {
if(xhr.readyState !== 4) {
return;
}
return cb(JSON.parse(xhr.responseText));
};
xhr.open("GET", baseUrl + url, true);
xhr.send();
}
var token = "51969C37-FA95-744C-BB29-075C684EBD33C086D050-124E-4575-994B-304F23DA6F70";
getJSON("pvp/stats?access_token=" + token, function(data) {
console.log(data);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment