Developing Webapps with Ajax, Pt. 2

I hope you all enjoy it. I’d be happy to get some feedback from the readership.

Newsvine | Del.icio.us | Digg
In Web, JavaScript, XML on October 11th, 2005 | 10 Remarks

10 Remarks to “Developing Webapps with Ajax, Pt. 2”

  1. Jason remarks:

    Cool. I’ve got to learn Ajax…

  2. treey remarks:

    look

  3. Philippe remarks:

    Can we find the code online ?

    Same question for pt. 3 ?

  4. Jona remarks:

    Hi Philippe,

    Yes, I put part 2 online.

  5. Philippe remarks:

    I’m trying to get part 3 to work with an .asp file instead of an .php, but I can’t get any value for obj.getElementsByTagName(’users’)[0] the value is null, is the users value correct ?

    I changed it to ‘data’ in this example of an xml file :

    -
    This is data

    This is the code that generates the xml :

    ” & vbNewLine
    Response.Write “” & vbNewLine
    Response.Write “This is data” & vbNewLine
    Response.Write “” & vbNewLine

    %>

  6. Philippe remarks:

    Again :

    Dit is de data

    and the code

    response.write “” & vbNewLine
    Response.Write “” & vbNewLine
    Response.Write “This is data” & vbNewLine
    Response.Write “” & vbNewLine

  7. Jona remarks:

    Philippe, look at the output of your .asp file. Is the XML well-formed? Everything is inside some sort of <tag>? All the tags are opened and closed properly, and nothing is improperly nested? Check those things on the output of the .asp script. Your problem is most likely there.

  8. Philippe remarks:

    When I use the xml file it works fine, I then copy the xml file and add response.write before each line, adding quotes where needed, but when I replace data.xml with data.asp the code stops working.

    This is the code :

    response.write &quot &lt?xml version=&quot&quot1.0&quot&quot encoding=&quot&quotUTF-8&quot&quot?&gt&quot
    response.write &quot&ltroot&gt&quot
    response.write &quot&ltdata&gt&quot
    response.write &quotThis is some sample data. It is stored in an XML file and retrieved by JavaScript.&quot
    response.write &quot&lt/data&gt&quot
    response.write &quot&lt/root&gt&ltquot

  9. Jona remarks:

    I’m not an ASP developer, but I believe you’ll need this line at the very beginning of your .asp file to specify the XML MIME settings for JavaScript to be able to read the output properly.
    <% Response.ContentType = "text/xml" %>

  10. Philippe remarks:

    YES !!!!!

    Pffffew, now it works !!

    So hard to find that info online !

    Thanks, now I can start using Ajax !

    Hoping to switch to php soon when our new servers are installed.

    Finding your articles very interesting !
    No reference to part 3 yet on this site ?

    Thanks !

Leave a Remark

 

Note: HTML is allowed. (<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> ).