Basic problem with scoping?
Hey guys, I'm new with JS and I'm trying to fiddle a little with Google Maps. I found a few tutorials and source codes, so I'm copy-pasting and trying to adapt it to my needs:
Here's what I need to do:
1. Load the map at a location
2. Load some markers from a file (I'm using JSON atm but I think I'll run into some problems later on)
3. Place the markers in the map
4. Put some checkboxes to toggle a group of markers.
Now, I was able to do it without step number 2 (source), but I can't load them from a file. If you see the source code in the next link (not the previous one), the features array is empty (check the console.log), maybe it's due to variable scoping? What can I do to avoid it? Here's the source:
Thanks in advance! :)
PS: regarding the JSON problem, I have to put some HTML code in the files (like on line 87 in main.js), should I just put everything in one line, or should I use another format instead of JSON? If so, which one do you recommend?