Getting the result in xml from ajax call

hi all,
I want to make a ajax call to rails to particular action which
returns xml and i want to get that xml in java script function.can any
one help me to do this???

regards,
senthil

senthil wrote:

hi all,
I want to make a ajax call to rails to particular action which
returns xml and i want to get that xml in java script function.can any
one help me to do this???

regards,
senthil

Which part do you need help with? Sending the results from Rails as XML?
Reading/parsing the XML in JavaScript?


Michael W.

senthil wrote:

     I want to make a ajax call to rails to particular action which

returns xml and i want to get that xml in java script function.can any
one help me to do this???

Suppose your application.js has function foo().

I suspect this action handler does what you need:

render :update do |rjs|
rjs.call :foo, my_xml
end

That’s all. The my_xml contents will be escaped as a big JavaScript
string, and ‘foo(’ & ‘)’ will be put around it. Then the whole string
will go across the wire, and get evaluated as JavaScript. It will
de-escape the string, find XML, and pass that to foo().


Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!