Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Siple AJAX, of course

0 views
Skip to first unread message

Monica Leko

unread,
May 9, 2008, 1:48:34 PM5/9/08
to
Doesn't work. :)

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?

Tom Cole

unread,
May 9, 2008, 2:57:52 PM5/9/08
to

Does your server indeed return a valid XML document with content-type
of "text/xml" and what does the entire XML document look like?

Monica Leko

unread,
May 9, 2008, 3:34:22 PM5/9/08
to
On May 9, 8:57 pm, Tom Cole <tco...@gmail.com> wrote:

> Does your server indeed return a valid XML document with content-type
> of "text/xml" and what does the entire XML document look like?

There was a problem in my form tag. This was the oldest one:
<form method="GET" action="/lbs/" onSubmit="filterMarkers();false" >

And the current one is
<form method="GET" action="/lbs/" onsubmit="return filterMarkers()" >

Now everything works. Thanks anyway.

0 new messages