If I store an array using a txt file, how can I load it back to jQuery?
Assuming the external txt is
['Parrot', 'Green'], ['Crow', 'Black'], ['Duck', 'White']
How can I load it as
var myArr = [ ['Parrot', 'Green'], ['Crow', 'Black'], ['Duck', 'White'] ];
This is what I've been trying. Does not work.
var myArr;
$.ajax({url: 'files/external.txt'}).done(function(d) {
myArr = JSON.parse('[' + d + ']');
});