primacag 0 Newbie Poster

Any help appreciated in advance....
I have been trying to get a javascript to use ajax to call a php script to read from an mysql database and write out an xml dom document so that I can add markers to a google map. I think I have all the parts, I can see the xml in the Firefox tools and it looks like the examples that are on http://code.google.com/apis/maps/articles/phpsqlajax_v3.html, the page I am using as a model. Still, my xml dosent make it back to the javascript for the next step.
I dont know what it is.

Could it be that the Ajax command needs to be synchronous?
Could it be that I need to escape key characters in the xml?
Could I have left out something not obvious to a newbie self starter?
Could it be some other problem?

Here is the code....
currently gives message xmlinput is undefined.....this is the returned xml variable name in the javascript which is the first listing below...
javascript...


////////////////// JAVASCRIPT //////////////////////////////////

function locationmap(lastx, lasty) {
      if (lastx == 0) { var latlng = new google.maps.LatLng(0, 0);
      var options = { zoom: 1, center: latlng,   mapTypeId: google.maps.MapTypeId.SATELLITE      } }
	else  { var latlng = new google.maps.LatLng(lasty, lastx );
	  var options = { zoom: 14, center: latlng,   mapTypeId: google.maps.MapTypeId.SATELLITE     } }
	  
      var map = new google.maps.Map(document.getElementById("locationmap"), options);
      var html = "<table>" + "Move the marker to your location... "+
                 "<tr><td></td><td><input type='button' value='Save & Close' onclick='getData()'/></td></tr>";
    infowindow = new google.maps.InfoWindow({     content: html    });
     google.maps.event.addListener(map, "click", function(event) {
        marker = new google.maps.Marker({ position: event.latLng, map: map,  draggable: true,  title: "Drag me!"});
        google.maps.event.addListener(marker, "click", function() {
          infowindow.open(map, marker);        });    });    }

    function getData() {
      var latlng = marker.getPosition();
      var url = "phpold/collectpoint.php?lat=" + latlng.lat() + "&lng=" + latlng.lng();

      getPoints(url, function(data, responseCode) {	  
//alert ('responsecode: '+responseCode);
        if (responseCode == 200 ) {
          infowindow.close();
          document.getElementById("locmessage").innerHTML = 
			"Ready to report species seen within "		
			+ " of these coordinates: latitude"
			+ latlng.lat() 
			+" and longitude "
			+ latlng.lng()
			+ ". </br> Proceed to step three and choose species to map. </b></p>"	; 



// alert ('returned');
var xmlinput = data.responseXML;
var xmlmarkers = xmlinput.documentElement.getElementByTagName("markerlist");
alert (data.length+" length data");
			 } });  }



    function getPoints(url, callback) {
      var request = window.ActiveXObject ?
          new ActiveXObject('Microsoft.XMLHTTP') :
          new XMLHttpRequest;

      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          request.onreadystatechange = doNothing;
          callback(request.responseXML, request.status);        }      };
      request.open('GET', url, true);
      request.send(null);  		}
    function doNothing() {}	


	
//	</script>

////////////////////////////////////////////////////////////////////////////////////
php for collecting from the database....

$selectobservation = 
     "SELECT observation.obsX, observation.obsY, observation.obsDate,
             obslist.idspecies, common.CommonName 
             FROM obslist
             INNER JOIN observation ON observation.idObservation = obslist.idObservation
             INNER JOIN common      ON common.idSpecies          = obslist.idSpecies 
             INNER JOIN region      ON region.IDSpecies          = obslist.idSpecies 
						
             WHERE region.GeoArea LIKE '$region%' AND
              common.language =   '$language' AND
              observation.obsX    BETWEEN '$minlng' and '$maxlng' AND
              observation.obsY    BETWEEN '$minlat' and '$maxlat' AND
              observation.obsDate BETWEEN DATE_SUB(CURDATE(),INTERVAL 1 $timespan ) AND CURDATE() ";
 
 $result = mysql_query($selectobservation);
 if (!$result) {  die('Invalid query: ' . mysql_error());}
 
$dom = new DOMDocument("1.0");
$node=$dom->createElement('markerset');
$parnode=$dom->appendChild($node);

 header("Content-type:text/xml"); 
while ($row = @mysql_fetch_assoc($result))         {  
   $node=$dom->createElement('markerlist');
   $newnode = $parnode->appendChild($node);  
   $newnode->setAttribute("name",$row['CommonName']);
   $newnode->setAttribute("date", $row['obsDate']);  
   $newnode->setAttribute('lats', $row['obsY']);  
   $newnode->setAttribute('long', $row['obsX']);  
                                      }

//$xmlfile = $dom->dump_mem();
echo $dom->saveXML();
//echo $dom;
//   echo $dom->saveXML();

////Here is the xml ...///////////////////////////////////////////////////////////////////////////////////

<?xml version="1.0"?>
<markerset><markerlist name="Azure Gallinule" date="2011-10-13" lats="42.5228483669754" long="-79.0772475633789"/><markerlist name="American Goldfinch" date="2011-10-10" lats="42.5370165610761" long="-79.0971603197266"/><markerlist name="American Goldfinch" date="2011-10-10" lats="42.5370165610761" long="-79.0971603197266"/><markerlist name="American Goldfinch" date="2011-10-10" lats="42.5370165610761" long="-79.0971603197266"/><markerlist name="American Crow" date="2011-10-10" lats="42.5370165610761" long="-79.0971603197266"/><markerlist name="American Coot" date="2011-10-10" lats="42.5370165610761" long="-79.0971603197266"/></markerset>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.