Foros del Web » Programando para Internet » Javascript »

google maps, anda en la web , no en remoto..

Estas en el tema de google maps, anda en la web , no en remoto.. en el foro de Javascript en Foros del Web. hola no entiendo que pasa, para colmo de todavia que no me sale ubicar marcadores desde mysql... ........... hay otro problema, encontre un ejemplo en ...
  #1 (permalink)  
Antiguo 29/01/2013, 02:07
 
Fecha de Ingreso: junio-2010
Mensajes: 752
Antigüedad: 13 años, 11 meses
Puntos: 5
google maps, anda en la web , no en remoto..

hola no entiendo que pasa, para colmo de todavia que no me sale ubicar marcadores desde mysql...
...........

hay otro problema, encontre un ejemplo en la web.QUE FUNCIONA PERO...
.........


este es el index....

Código PHP:
<html>
<
head>
<
meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<
meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<
title>Google Maps JavaScript API v3 ExampleCommon Loader</title>
<
script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript">
  var infowindow;
  var map;

  function initialize() {
    var myLatlng = new google.maps.LatLng(37.4419, -122.1419);
    var myOptions = {
      zoom: 13,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    downloadUrl("moredata.xml", function(data) {
      var markers = data.documentElement.getElementsByTagName("marker");
      for (var i = 0; i < markers.length; i++) {
        var latlng = new google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
        var marker = createMarker(markers[i].getAttribute("name"), latlng);
       }
     });
  }

  function createMarker(name, latlng) {
    var marker = new google.maps.Marker({position: latlng, map: map});
    google.maps.event.addListener(marker, "click", function() {
      if (infowindow) infowindow.close();
      infowindow = new google.maps.InfoWindow({content: name});
      infowindow.open(map, marker);
    });
    return marker;
  }

</script>
</head>
<body onload="initialize()">
  <div id="map_canvas" style="width:400px; height:300px"></div>
</body>
</html> 
este es el archivo util

Código PHP:
/**
* Returns an XMLHttp instance to use for asynchronous
* downloading. This method will never throw an exception, but will
* return NULL if the browser does not support XmlHttp for any reason.
* @return {XMLHttpRequest|Null}
*/
function createXmlHttpRequest() {
 try {
   if (
typeof ActiveXObject != 'undefined') {
     return new 
ActiveXObject('Microsoft.XMLHTTP');
   } else if (
window["XMLHttpRequest"]) {
     return new 
XMLHttpRequest();
   }
 } catch (
e) {
   
changeStatus(e);
 }
 return 
null;
};

/**
* This functions wraps XMLHttpRequest open/send function.
* It lets you specify a URL and will call the callback if
* it gets a status code of 200.
* @param {String} url The URL to retrieve
* @param {Function} callback The function to call once retrieved.
*/
function downloadUrl(urlcallback) {
 var 
status = -1;
 var 
request createXmlHttpRequest();
 if (!
request) {
   return 
false;
 }

 
request.onreadystatechange = function() {
   if (
request.readyState == 4) {
     try {
       
status request.status;
     } catch (
e) {
       
// Usually indicates request timed out in FF.
     
}
     if (
status == 200) {
       
callback(request.responseXMLrequest.status);
       
request.onreadystatechange = function() {};
     }
   }
 }
 
request.open('GET'urltrue);
 try {
   
request.send(null);
 } catch (
e) {
   
changeStatus(e);
 }
};

/**
 * Parses the given XML string and returns the parsed document in a
 * DOM data structure. This function will return an empty DOM node if
 * XML parsing is not supported in this browser.
 * @param {string} str XML string.
 * @return {Element|Document} DOM.
 */
function xmlParse(str) {
  if (
typeof ActiveXObject != 'undefined' && typeof GetObject != 'undefined') {
    var 
doc = new ActiveXObject('Microsoft.XMLDOM');
    
doc.loadXML(str);
    return 
doc;
  }

  if (
typeof DOMParser != 'undefined') {
    return (new 
DOMParser()).parseFromString(str'text/xml');
  }

  return 
createElement('div'null);
}

/**
 * Appends a JavaScript file to the page.
 * @param {string} url
 */
function downloadScript(url) {
  var 
script document.createElement('script');
  
script.src url;
  
document.body.appendChild(script);

este es el XML...


Código PHP:
<?xml version="1.0" encoding="UTF-8"?>
<markers>
  <marker name="Jackie" lat="37.427770" lng="-122.144841"/>
  <marker name="Peter" lat="37.413320" lng="-122.125604"/>
  <marker name="Mary" lat="37.433480" lng="-122.139062"/>
  <marker name="Puff" lat="37.445427" lng="-122.162307"/>
</markers>
esta es la web...


http://gmaps-samples-v3.googlecode.c...durl_info.html



AHI ANDA, CUANDO DESPUES DE HABER COPIADO LOS CODIGOS EN MI CASA, NO ANDA, NO ANDA, NO ME APARECEN LOS MARCADORES..

pruebenlo, no se que pasa,ya me tieneeee

el xml , se llama moredata.xml
  #2 (permalink)  
Antiguo 29/01/2013, 07:52
Avatar de maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 9 meses
Puntos: 1532
Respuesta: google maps, anda en la web , no en remoto..

utilice una consola web como firebug para descartar errores 404 o 500, en dado caso puede ser problema de permisos en apache, ¿tenia algún .htaccess?
__________________
¡Por favor!: usa el highlight para mostrar código
El que busca, encuentra...

Etiquetas: anda, google, html, maps, mysql, php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:29.