Ahora el detalle esta en que las tiendas van a tener su marker en el mapa, pero sus coordenadas y toda su info, esta guardada en una BD, ¿Cómo logro cargar esos datos de la BD para que el JS los lea y los interprete? :S.
Acá les dejo el código de la app:
index.html
Código HTML:
Ver original
<!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> </head> <body onload="iniciar()"> <form name="f1"> <select name="delegacion" onchange="cambiar_mapa()"> </select> <select name="local" onchange="mostar_locales()"> </select> </form> </body> </html>
maps.js
Código Javascript:
Ver original
var coords_deleg = [ new google.maps.LatLng(19.437457,-99.131126), new google.maps.LatLng(19.373341,-99.223394), new google.maps.LatLng(19.483343,-99.183898), new google.maps.LatLng(19.372207,-99.157891), new google.maps.LatLng(19.349534,-99.161768), new google.maps.LatLng(19.361033,-99.284163), new google.maps.LatLng(19.420378,-99.159694), new google.maps.LatLng(19.482453,-99.112501), new google.maps.LatLng(19.395201,-99.097896), new google.maps.LatLng(19.357794,-99.093304), new google.maps.LatLng(19.316246,-99.239774), new google.maps.LatLng(19.418354,-99.201078), new google.maps.LatLng(19.191096,-99.023645), new google.maps.LatLng(19.268855,-99.005041), new google.maps.LatLng(19.308875,-99.22514), new google.maps.LatLng(19.439157,-99.113123), new google.maps.LatLng(19.274202,-99.137936) ]; function iniciar() { var myOptions = { panControl: false, mapTypeControl: false, zoom: 11, center: coords_deleg[0], mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } function select_local() { var delegacion = document.f1.delegacion[document.f1.delegacion.selectedIndex].value; if (delegacion != 0) { document.f1.local.length = 3; document.f1.local.disabled = false; document.f1.local.options[0].value = "-"; document.f1.local.options[0].text = "-"; document.f1.local.options[1].value = "1"; document.f1.local.options[1].text = "Local"; document.f1.local.options[2].value = "2"; document.f1.local.options[2].text = "Bodegas"; } else { document.f1.local.length = 1; document.f1.local.disabled = true; document.f1.local.options[0].value = "-"; document.f1.local.options[0].text = "-"; } document.f1.local.options[0].selected = true; } function cambiar_mapa() { var delegacion = document.f1.delegacion[document.f1.delegacion.selectedIndex].value; var myOptions = { panControl: false, mapTypeControl: false, zoom: 13, center: coords_deleg[delegacion], mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); select_local(); } function mostrar_locales() { /* Aqui necesito cargar coordenadas de una BD y ponerlos en el mapa :/ */ }