Here is the data I am working with:
{"todo":[{"todo":"Khaleeq Raza"},{"todo":"Ateeq Raza"}]}
This is my current code snippet:
var dataArray = [];
var client = new XMLHttpRequest();
client.open("GET", "http://192.168.10.109/read_todo_list.php", true);
client.send();
client.onreadystatechange = function() {
json = JSON.stringify(client.response); // convert to JSON
var get = console.log(JSON.parse(json));
for (var i = 0; i < get.length; i++) {
var row = Ti.UI.createTableViewRow({
title: get[i].todo,
hasChild: true,
});
dataArray.push(row);
}
$.tableView.setData(dataArray);
};
I encountered this error message:
Uncaught TypeError: Cannot read property 'length'
How can I resolve this issue?