I currently have this multidimensional array:
var locations = [
['Event', 'Monday', 50.820250, -0.143534, 'Image', 'fa fa-heart'],
['Event 2', 'Tuesday', 50.819939, -0.140978, 'Image', 'fa fa-heart'],
];
And I have a JavaScript file with this:
$(function ()
{
$.ajax({
url: 'locations.php', data: "", dataType: 'json', success: function(rows)
{
for (var i in rows)
{
var row = rows[i];
var id = row.id;
var name = row.name;
var date = row.date;
var lat = row.lat;
var long = row.long;
var image = row.header;
var test = "['" + name + "', '" + date + "', " + lat + ", " + long + ", '" + image + "', 'fa fa-heart'],";
locations.push(test);
}
}
});
async: false
});
It's grabbing all the information from the PHP file fine, however I would like to "push" / add a new event into the current array for every loop.
Any help is greatly appreciated!
test
is a string, not an array.locations
? They look like they should be objects.