I have a PHP script that returns a JSON object which looks like this in the console:
[{"CONTAINER_NUMBER":"CONT1234567","RETURN_POOL":"GARDENCITY"},{"CONTAINER_NUMBER":"CONT987654","RETURN_POOL":"NORTHTOWN"}]
All I need to do is create another array that contains only the CONTAINER_NUMBER value. It should look like this:
"CONT1234567", "CONT987654"
I found this: http://jsfiddle.net/arunpjohny/ygqaa/
I changed it around to look like the below:
$.POST('phpScript.php', {cntArray:cntArray}, function(data)
{
var containers = JSON.parse(data);
var obj = {};
$.each(containers, function(i, v){
obj[v.CONTAINER_NUMBER]
});
console.log(obj)
});
But the console only shows a blank array.