Siple AJAX, of course

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Monica Leko

    Siple AJAX, of course

    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('G ET', '/lbs/' + getVars, true);
    request.onready statechange = function() {
    if (request.readyS tate == 4) {
    var xmlDoc = request.respons eXML;
    alert(xmlDoc);
    var responseNode = xmlDoc.getEleme ntsByTagName('m arkers').item(0 );
    var type = responseNode.ge tAttribute("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

    #2
    Re: Siple AJAX, of course

    On May 9, 1:48 pm, Monica Leko <monica.l...@gm ail.comwrote:
    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('G ET', '/lbs/' + getVars, true);
    request.onready statechange = function() {
      if (request.readyS tate == 4) {
        var xmlDoc = request.respons eXML;
        alert(xmlDoc);
        var responseNode = xmlDoc.getEleme ntsByTagName('m arkers').item(0 );
        var type = responseNode.ge tAttribute("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?

    Comment

    • Monica Leko

      #3
      Re: Siple AJAX, of course

      On May 9, 8:57 pm, Tom Cole <tco...@gmail.c omwrote:
      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="filte rMarkers();fals e" >

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

      Now everything works. Thanks anyway.

      Comment

      Working...