I got it to work
Here is what I did.  it uses some jQuery as well.

function locate() {
  //turn on locating text
  $('#geocodingText').show();
  $('#latLongText').hide();

  $.ajax({
        type: "POST",
        url: "address.php",
        data: "streetAddress="+$('#streetAddress').val()+"&cityAddress="+$
('#cityAddress').val()+"&stateAddress="+$('#stateAddress').val()
+"&zipAddress="+$('#zipAddress').val(),
        success: function(msg){
          $('#geocodingText').hide();
          if(msg=='Failed'){
                alert("The address failed to geocoded");
                m = "Geocoding Failed";
                $('#latLongText').text(m);
                $('#latLongText').show();
                map.removeOverlay(markersArray[eval(markerCounter)]);

          }else{
                markerCounter = markerCounter+1;
                $('#latLongText').text(msg);
                $('#latLongText').show();
                myArray = msg.split(",");
                map.setCenter(new GLatLng(eval(myArray[0]), eval(myArray[1])), 
12);
                addressCenter = new GLatLng(eval(myArray[0]), eval(myArray[1]));
                marker = new GMarker(addressCenter, {icon:iconHome, draggable: 
true,
clickable: false});
                markersArray[markerCounter] = marker;
                map.addOverlay(markersArray[eval(markerCounter)]);
                map.removeOverlay(markersArray[eval(markerCounter-1)]);

                GEvent.addListener(marker, "dragstart", function() {
                  //map.closeInfoWindow();
                });

                GEvent.addListener(marker, "dragend", function() {
                  $('#latLongText').text(marker.getPoint().toUrlValue());
                  $('#latLongText').show();
                  //
document.getElementById("latLongText").value=marker.getPoint().toUrlValue();
                  //marker.openInfoWindowHtml("Just bouncing along...");
                });
          }
        }
  });
}


function initialize() {
  iconHome = new GIcon();
  iconHome.image = 'http://maps.google.com/mapfiles/kml/pal3/
icon56.png';
  iconHome.shadow = 'http://maps.google.com/mapfiles/kml/pal3/
icon56s.png';
  iconHome.iconSize = new GSize(32, 32);
  iconHome.shadowSize = new GSize(59, 32);
  iconHome.iconAnchor = new GPoint(16, 16);
  iconHome.infoWindowAnchor = new GPoint(16, 16);

  if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("mapPane"));
        map.setCenter(new GLatLng(42, -93), 6);
        var customUI = map.getDefaultUI();
        customUI.controls.scalecontrol = false;
        customUI.controls.menumaptypecontrol  = true;
        map.setUI(customUI);

        addressCenter = new GLatLng(42, -93);
        marker = new GMarker(addressCenter, {icon:iconHome, draggable: true,
clickable: false});

        markersArray = [];
markerCounter = 0;

        markersArray[0] = marker;
        map.addOverlay(markersArray[0]);
        map.removeOverlay(markersArray[0]);


        GEvent.addListener(marker, "dragstart", function() {
        //map.closeInfoWindow();
                });

        GEvent.addListener(marker, "dragend", function() {
        //
document.getElementById("latLongText").value=marker.getPoint().toUrlValue();
        //marker.openInfoWindowHtml("Just bouncing along...");
        });

  }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" 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-api?hl=en.

Reply via email to