i have an array called items=[\"apple\",\"mango\",\"cherry\"];
i wonder how i can load the array data from text file instead of declaring it?the text f
With jQuery you can do something like this
$.get("textFile.txt", function(data) {
var items = data.split(',');
});
You may need something like this though
var items = data.replace(/"/g, '').split(',');
This is a start.
If this is a user input file then you may need to upload it before you work with it.