Hi Danilo
It's actually quite easy if you remember how Magnolia renders an HTML
page.
Basically, every request worked on by Magnolia generates a dynamic
response, usually with a JSP. So what you will want to do is write a
second script to do the server side stuff after an AJAX call.
The first script is the main script, with some button calling the
JavaScript AJAX functions. The trick is that the AJAX function
requests a "node/page" (or the JSP directly). I often use
subtemplates, because the JSP has to respond according to the current
page. So all the second JSP has to do is generate the XML response or
a simple text. You might even create a page which has paragraphs for
each individual functionality you want to return to the AJAX call.
HTH
/giancarlo
On Nov 2, 2008, at 4:11 PM, Danilo Ghirardelli wrote:
My goal is to get an ajax website working with magnolia, so I'd like
to
know if somebody already tried something in this direction, Magnolia
uses ajax for its backend, but I haven't found anything that can do,
for
instance, an asynchronous update of a paragraph within a template.
The first quick and dirty solution I came at was to create a
subtemplate
containing the single paragraph I needed to update, and do an ajax
call
to that subtemplate. But this works well only if I have a few
paragraphs
to update, not as a general purpose.
My next idea is to store somewhat (maybe in the "class" attribute?)
the
uuid of template and paragraphs in the generated html page, surround
each paragraph with a identifiable div and then sending both uuid
along
the ajax request. On server side there will be a single template for
those ajax request, that will load the page and paragraph
corresponding
to the uuid and renders the paragraph back.
But this is just my first tought. Have you ever tried anything like
this? Any suggestion?
Regards, Danilo.
----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------