I am using Google maps example from book, and from Google documentation. It is really simple, and I don't know why isn't working. My browser send mi this response:
This XML file does not appear to have any style information associated with it. The document tree is shown below. <markers id="id je ok"> <marker found="Keychain" lat="37.441" left="Book" lng="-122.141"/> <marker found="Water Bottle" lat="37.322" left="Necklace" lng="-121.213"/> </markers>
My code is following var getVars = "?q=" + search; var request = GXmlHttp.create(); request.open('GET', '/lbs/' + getVars, true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; alert(xmlDoc); var responseNode = xmlDoc.getElementsByTagName('markers').item(0); var type = responseNode.getAttribute("id"); }
}
responseXML allways sends back null value, although server sends back XML. And, what I don't understanf (still newbie), after the alert popups and write "null", my browser render upper XML file, instead doing nothing and show page from which I called AJAX function. How can this be?
> I am using Google maps example from book, and from Google > documentation. It is really simple, and I don't know why isn't > working. My browser send mi this response:
> This XML file does not appear to have any style information associated > with it. The document tree is shown below. > <markers id="id je ok"> > <marker found="Keychain" lat="37.441" left="Book" lng="-122.141"/> > <marker found="Water Bottle" lat="37.322" left="Necklace" > lng="-121.213"/> > </markers>
> My code is following > var getVars = "?q=" + search; > var request = GXmlHttp.create(); > request.open('GET', '/lbs/' + getVars, true); > request.onreadystatechange = function() { > if (request.readyState == 4) { > var xmlDoc = request.responseXML; > alert(xmlDoc); > var responseNode = xmlDoc.getElementsByTagName('markers').item(0); > var type = responseNode.getAttribute("id"); > }
> }
> responseXML allways sends back null value, although server sends back > XML. And, what I don't understanf (still newbie), after the alert > popups and write "null", my browser render upper XML file, instead > doing nothing and show page from which I called AJAX function. How > can this be?
Does your server indeed return a valid XML document with content-type of "text/xml" and what does the entire XML document look like?