Jump to content

Google Map API - Update Markers


msnyder0

Recommended Posts

i'm trying to figure out how to update a map marker for the Google Maps API. i took existing code that works correctly and tried to apply it to my solution but i haven't been able to get it to work... here is the code that works to store new markers (slightly abbreviated)...

 

 

 

function storeMarker() {

    var getVars = "?species=" + document.getElementById("species").value       

        + "&lat=" + lat;

 

    var request = GXmlHttp.create();

 

    //open the request to storeMarker.php on your server

    request.open('GET', 'storeMarker.php' + getVars, true);

    request.onreadystatechange = function() {

        if (request.readyState == 4) {

            //code...

          }

    }

    request.send(null);

    return false;

}

 

 

 

for my solution, i have the following function that is triggered by this code...

 

<form name="MarkerForm" onSubmit="return updateMarker()">

 

all of the fields are inside the form and i have confirmed the URL string is formatted correctly with the alert(); below. the updateMarker.php page has been tested independently and works correctly, but when i try to update a marker from the map API it does not update the form data or database record and does not give me any errors. any suggestions? thanks!

 

 

 

function updateMarker() {

        var getData = "?species=" + document.getElementById("species").value

                + "&lat=" + lat;

 

    //alert('updateMarker.php' + getData); <-- this has confirmed the URL string is formatted correctly

 

    var request = GXmlHttp.create();

    request.open('GET', 'updateMarker.php' + getData, true);

 

    request.send(null);

    return false;

}

 

 

Link to comment
https://forums.phpfreaks.com/topic/129566-google-map-api-update-markers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.