I have this simple function:
var t_devices = [
["192.168.1.60", "Central"],
["192.168.1.61", "Back"],
["192.168.1.62", "Right"],
["192.168.1.63", "Left"]
];
function drawCards() {
for (var i = 0; i < t_devices.length; i++) {
$.get("assets/t-div.html", function(data) {
$('#t-container').append(data);
$('#t-tile').html(t_devices[i][1]);
});
}
}
Upon execution I get an error:
Uncaught TypeError: Cannot read property '1' of undefined
It seems that I cannot read the variable t_devices
in the $.get()
function.