Reputation: 990
I have this, what I'm trying to do is convert the data to an array, but I think this doesn't work, so how can I convert the data to an string so then I can do the split?
$.ajax({
url:"instructions.txt"
}).done(function(data){
data.split("\n");
alert(data);
})
This is my instructions.txt (UTF-8):
the-nap.mp4
0
7
19
25
Upvotes: 0
Views: 36
Reputation: 1422
This should work :
$.ajax({url:"instructions.txt"}).done(function(data){
var myArray;
myArray = data.toString().split("\n");
for(var i in myArray) {
alert(myArray[i]);
}
});
Upvotes: 1