Uncaught TypeError: Cannot call method 'push' of undefined
google-chrome, google-maps-api-3, javascript, syntax-error
Solution
It's not really easy to tell, but basing on a comments, the object you're calling `push` method on is probably `undefined`. And this `object` should be an `array`.
Replace this line:
layer[result['layerId']].push(result);
With following code:
if("undefined" != typeof layer[result['layerId']]) {
layer[result['layerId']].push(result);
}
else {
layer[result['layerId']] = new Array();
layer[result['layerId']].push(result);
}
Let me know if it works.
Problem
I have been stuck at this error for days, can any kind soul decipher this error? The alert shows the correct data that is needed but somehow the push() method just doesn't work.. Thanks in advance!