I have a simple AJAX script to load a file into an array.
var loadGame = function() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
game = this.responseText
}
};
xhttp.open('GET', 'games/' + $('.meta').html() + '.game', true);
xhttp.send();
}
However, game is treated as a string, not an array, even if this.responseText is a valid array. How can I get JS to treat this.responseText as an array when I store it to game?
built in command to convert between types- what does the received data look like ... exactly['a','b'], and how AJAX import it:"['a','b']".["a", "b"]- which is why I asked why you'd need to add extra complexity