How to declare and use the name of a function from a json object?
        Posted  
        
            by Sebastian
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sebastian
        
        
        
        Published on 2010-04-20T17:47:24Z
        Indexed on 
            2010/04/20
            17:53 UTC
        
        
        Read the original article
        Hit count: 234
        
Hello,
I have a json object collection of geo locations that I build in the server. Each of those objects has two properties: "marker" and "onClick".
Marker is for storing a Google Maps marker object and the onClick stores the name of the function to be called when that marker is clicked on the map.
When I'm pushing the location objects into an array using javascript in the client side, I create the markers and assign them to each location object within the array.
My problem is that when I bind the marker with the onClick property, the function won't be found in the DOM and get an error.
Is there a way to declare a property in a json object for using it on an event binding?
Hope I could explain it clearly, if not, please let me know.
Thanks!
© Stack Overflow or respective owner