Hello I'm having a problem updating the text on the info window when the button saveData is clicked below
Hee is te code it currently works and saves the location to a MySQL database and the message to show this is shown below the map but i'd like it to be shown in the infowindow when the saveData button is clicked. How do I do this?? The page can be seen here http://test.digitaldemocracy.org.uk/maps/add_marker2.php var marker; var infowindow; function initialize() { var latlng = new google.maps.LatLng(51.062,-0.29505); var options = { zoom: 11, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), options); var html = "<p> </p><p>Is this the correct position?</ p><p> </p><p>you can drag this marker</p><p> </p><input type='button' value='Save location' onclick='saveData()'/>"; infowindow = new google.maps.InfoWindow({ content: html }); google.maps.event.addListenerOnce(map, "click", function(event) { marker = new google.maps.Marker({ position: event.latLng, map: map, draggable: true }); infowindow.open(map, marker); }); } function saveData() { var latlng = marker.getPosition(); var url = "http://test.digitaldemocracy.org.uk/maps/ addinfo_latlng.php?&lat=" + latlng.lat() + "&lng=" + latlng.lng(); downloadUrl(url, function(data, responseCode) { if (responseCode == 200 && data.length <= 1) { document.getElementById("message").innerHTML = "Location added."; document.getElementById('html').innerHtml = 'Now here you add your new code'; } }); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request.responseText, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} When the function saveData is run I want the content of the infowindow shown to change " Location added, thanks " and a href link to anothe page on the website do you have any ideas how to help?? -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
