[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [OT] using ajax
- From: Tei <oscar.vives@gmail.com>
- To: "XML Developers List" <xml-dev@lists.xml.org>
- Date: Wed, 8 Nov 2006 09:16:56 +0100
OFF-TOPIC
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.
- References:
- using ajax
- From: "Diana Castillo" <diana@hotelkey.com>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]