I found some possible solutions on this site but none of them really helped me forward.
My array looks like this:
[
{"customerName":"Atelier graphique","addressLine1":"54, rue Royale"},
{"customerName":"Signal Gift Stores","addressLine1":"8489 Strong St."},
etc, etc
I want to change the customerName to value and addressLine1 to data. I tried the following but I am doing something wrong here.
var myArray = [];
$(document).ready(function () {
$("#text-id").on( 'click', function () {
$.ajax({
type: 'post',
url: 'connect.php',
success: function( data ) {
console.log( data );
myArray.push(data);
}
});
});
function DumpCustomers() {
for(i=0;i<myArray.length; i++){
myArray[i].addressLine1= "data";
delete myArray[i].addressLine1;
myArray[i].customerName= "value";
delete myArray[i].customerName;
}
alert(myArray);
}