Reading .txt file into Javascript / jQuery array
I am trying to read a file (stored on a web server) into an array. When I print the array, I am currently getting "undefined". Here is the code im using:
var cardRules = new Array;
$.get('UserFile.txt', function(data){
var array = data.split('\n');
console.log(cardRules);
});
Any help would be appreciated!
+3
source to share