I have a piece of code that I am not sure is operating the way I think it is -
echo json_encode(array('html' => $html_string, 'cid' => $cid));
My understanding of this is that it is taking the $html_string
and the $cid
and adding a Key to each with the line of 'html' => $html_string
yes?
Then it is gathering both of these variables with the keys and packaging them into a single array, yes?
If that is the case, I am baffled as to why when I look at the output of these on the AJAX data return - dataType: 'JSON', success: function(data) { console.log(data.cid);
that they do not contain a key. An example of a console log:
(3) […]
0: "45"
1: "46"
2: "47"
length: 3
Should not each contain the key cid
?