Skip to content

Instantly share code, notes, and snippets.

@jackBonadies
Created April 13, 2019 21:08
Show Gist options
  • Save jackBonadies/6ba95fb471a72671364fc7c70fcf54c8 to your computer and use it in GitHub Desktop.
Save jackBonadies/6ba95fb471a72671364fc7c70fcf54c8 to your computer and use it in GitHub Desktop.
function gettingData(){
var txt;
var httpGetter = new XMLHttpRequest();
httpGetter.open("GET","file:///Users/jackbonadies/lastFMtop50/listOfFiles.txt",false);
httpGetter.onreadystatechange = function() {
if(httpGetter.readyState === 4){
if(httpGetter.status === 200 | httpGetter.status === 0){
var rawText = httpGetter.responseText;
txt = rawText;
return txt;
}
}
}
httpGetter.send(null);
return txt; //return has to be here as well!!!
}
function processData(data){
var allTextLines = data.split(/\r\n|\n/);
for (var i=0;i<allTextLines.length;i++){
console.log(allTextLines[i]);
}
return allTextLines;
};
function galleryGenerator(txt){
for (var i=0;i<txt.length;i++){
$("#top50").append("<img src=./top50images/" + txt[i] + ">");
if(i%7==6){$("#top50").append("<br>");};
if(i==48){break;};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment