Skip to content

Instantly share code, notes, and snippets.

@cdmcmahon
Last active May 18, 2016 05:35
Show Gist options
  • Save cdmcmahon/d968b9c582e7c71efb85d545d4e78a3d to your computer and use it in GitHub Desktop.
Save cdmcmahon/d968b9c582e7c71efb85d545d4e78a3d to your computer and use it in GitHub Desktop.
var nlWest = [
[119, "Los Angeles", null, null, null],
[137, "San Francisco", null, null, null],
[135, "San Diego", null, null, null],
[109, "Arizona", null, null, null],
[115, "Colorado", null, null, null]
];
var createEnterDataFunc = function(team){
return function(data) {
team[2] = parseInt(data.firstChild.nextSibling.firstChild.nextSibling.getAttribute("W"));
team[3] = parseInt(data.firstChild.nextSibling.firstChild.nextSibling.getAttribute("L"));
team[4] = parseInt(data.firstChild.nextSibling.firstChild.getAttribute("R")) - parseInt(data.firstChild.nextSibling.firstChild.nextSibling.getAttribute("R"));
};
};
for (var i = 0; i < nlWest.length; i++){
var team = nlWest[i];
// xml = create XML request here with team[0] as id parameter
xml.onload = createEnterDataFunc(team)
xml.send()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment