var request = new XMLHttpRequest(); request.open('GET','graphics/day.txt', false); request.send(); var dtext= request.responseText; dtext = dtext.replace(/\s{2,}/g, ' '); var darr = dtext.split(' ');