Before my Ajax function is called, I have a global scoped names array like this:
var names = ["John Smith","Mike Jones","Jenny White","April Brown"];
In the success function of the ajax call I need to erase the array and repopulate it with new names passed back to the page in Json format (v.name in the example below).
But I'm not sure how to append to the array in the course of my $.each loop:
$.each(data, function() {
$.each(this, function(k, v) {
// how to add `v.name` to the `names` array?
});
});