I am trying to populate a table with data from a JavaScript query. Currently, the problem I am running into is that no table is created, and consequently, no data is displayed. A working version of this method can be viewed here. Thanks!
// Initializes Parse
// Defines Parse Object Array
var object = {};
// Defines Data Query
var query = new Parse.Query("_User");
query.find({
success: function(results) {
// Creates Table in Document
var table = document.createElement("table");
var row = table.insertRow(0);
// Sets Table Attributes
table.setAttribute("border", "1");
table.setAttribute("width", "100%");
// Loops Through Query
for (var i = 0; i < results.length; i = i + 1) {
// Stores Results
var object = results[i];
var text = object.get("firstName") + " " + object.get("lastName");
var cell = row.insertCell(i);
cell.setAttribute("align", "center");
cell.appendChild(text);
}
document.getElementById("main").appendChild(table);
},
failure: function(error) {
alert("Something Went Wrong");
}
});
<!DOCTYPE html>
<html>
<body>
<div id="main">
<!-- Destination -->
</div>
</body>
</html>