I have a PHP array of objects that have a function, getValue which gets the object's value. So, if i want to get it's value in PHP i just:
echo mapArray[2][2]->getValue;
I passed the array to JS using:
var mapArray = <?php echo json_encode($mapArray); ?>
If i do a
document.write(mapArray);
i get a whole array of "object Object" strings. If i try:
document.write(mapArray.[2][2].getValue);
i get "undefined".
Why this happens? Do i have to mimic PHP data object so the methods are recognised in JS or the JSON encoding can give me a hand with this?
mapArray[2][2]->getValue(). IfgetValueis a simple property, and not a method, the rest of the question doesn't make sense.