Like as title, i want to make a function read file to an array with passing parameters and return the result to this function. This is my code:
function getdata(url) {
var myArr = "";
var exArr = "";
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myArr = xmlhttp.responseText;
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
exArr = myArr.split('\n');
return exArr;
}
var getit = getdata("http://pastebin.com/raw/BtqPzkHg")
console.log(getit)
But unfortunately, it's not working and if so, could you give me your ideas, thank you so much