pero cuál es el campo que tiene el valor que hará que se pinte? El abr. 6, 2016 21:15, "Carlos Montelongo" <monte...@gmail.com> escribió:
Y que es lo que obtienes de respuesta? Tienes el arreglo de Markers listos para dibujar en el mapa? Saludos, Carlos Montelongo On Apr 6, 2016, at 12:10, Sandra Venancio <soamna...@gmail.com> wrote: Existe la manera de hacerlo? Mi problema es el siguiente, tengo una Base de Datos en SQL con varios datos ya guardados de algunos usuarios y lo que me gustaría saber es si hay alguna manera para que esos datos se lean desde la BD y se pinten en tiempo real en mi mapa con un marcador (marker), he visto muchos ejemplos de este tipo o similares pero no he encontrado alguno que me pueda servir. Investigue y encontré que se puede hacer con formato JSON y que mande a llamar con AJAC pero no me ha quedado :( Esta es mi llamada que hago mediante AJAX: function jalarMarcadores(){ $.ajax({ type: "GET", url:"modulos/grabarmarcador/actualizar.php", dataType:"json", //data:{rpu:rpu, nombre:nombre, direccion:direccion, tarifa:tarifa, hilos:hilos, X:x, Y:y}, //contentType: "application/json; charset=utf-8", //cache:true, success: function(respuesta) { if (respuesta.length !== 0) { $.each(respuesta, function(marker, respuesta) { mapCenter2 = new google.maps.LatLng(19.1275333,-99.2800458); bounds.extend(latLng); }); } } }); } window.setInterval("jalarMarcadores();", 20000); Y esta es mi formato en JSON: <?php $link=mssql_connect("10.70.67.128","admin","sia#2016"); //Seleccionamos la base de datos mssql_select_db("siaes",$link); //Generamos la consulta $query=mssql_query("SELECT rpu,nombre,direccion,tarifa,hilos,x,y from t_ordenes",$link); while($row=mssql_fetch_array($query)){ $rpu=$row['rpu']; $nombre=$row['nombre']; $direccion=$row['direccion']; $tarifa=$row['tarifa']; $hilos=$row['hilos']; $X=$row['x']; $Y=$row['y']; for($i=0;$i<count($row);$i++) echo $row[$i]."<br>"; echo "<hr>"; $datos_completos="[$rpu*||*$nombre*||*$direccion*||*$tarifa*||*$hilos*||*$X*||*$Y]"; } //Cerramos la conexion mssql_close($link); ?> <script type="text/javascript"> //Pass PHP variable declared above to JavaScript variable var respuesta = <?php echo json_encode($datos_completos) ?>; alert(respuesta); </script> -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout.