OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [OT] using ajax


On 11/6/06, Diana Castillo <diana@hotelkey.com> wrote:
> Any ideas how to use ajax to have a form submit send an xml, process it and
> show it on the same page?
> using php?

Well... you can replace the submit button for a onclick button

<input type="submit" value="Send">

to this

<input type="button" value="Send" onclick="SendDataTroughAjax()">

this function SendDataTroughAjax need to read the .value of the form
fields and build a POST response with url the form action.

The server side response (the PHP stdio output) can be the new data to
render. The data can be XML, Json, text or urlcoded. Json is directly
useable as JS objects, while on XML you need to walk the tree* or
request for elements by id. Using text as in like CSV is hacky.

With the data the server return (XML,json, text, urlencoded
params,etc) you rebuild the html tree trough DOM api methods, or do a
fast & ugly .innerHTML.  But innerHTML is not XML friendly, so you
will avoid him on XHTML.

*: Maybe you can avoid that, maybe you can directly create a dom tree
from the xml tree and style it. Theres a few automagically steps to do
here, but XML is design to able automagic everywhere.

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS