You are not logged in.
Pages: 1
I am still a newbie at this but since most of the examples are based on static data (not questioning the quality of the examples though!) I need to dynamically inject data to GMAP3.
In particular I have my KML files, I want that on load the script retrieves an URL from my site that will return a list of KML URLs or something like that. Then after it receives it (which may as well be triggered by pressing a button), it would then dynamically inject "addKmlLayer" actions into the GMAP3 instance.
Is there a way to achieve that rather than hardcoding all the addKmlLayer actions?
Offline
Not really clear exactly what you are trying to , but you could do something like this:
var kmlOptions = {/* kml overlay options */};
var $map=$('#map');
$.getJSON(url, function(data) {
/* assumes data is a simple array of url's in json format*/
$.each(data, function(index, url) {
$map.gmap3({
action: {
action: 'addKmlLayer',
url: url,
options: kmlOptions
}
});
});
});
Offline
Pages: 1