Home
TeamSite
Returning JSON from AJAX
Matias
Hello,
We have a number of javascript components that make heavy use of AJAX using Jquery and EXTJS. These components rely on getting JSON back from the ajax calls.
Is there a way to return JSON from components instead of XML?
Find more posts tagged with
Comments
miroperez
Yes you can output json for your ajax calls.
Look at the sample in :
com.interwoven.livesite.external.runtime.Debugging -> ajaxRenderAsJson()
First add a page token to your component that will generate a URL for the ajax call to itself: $AJAX_URL[]
Now configure the component to call your output generator when AJAX call is received:
[html]
Rezrov
Open door
Frobozz
[/html]
Param is optional, the name/value pairs will be available as: context.getThisComponent().getAjaxOutputGenerator().getParams()
There is an issue with using ExtJS since the page editor uses these libs heavily there are possible collisions with versions and the rendering mechanism needed by your components (renderTo won't work). I've successfully used jquery to create components using ajax and json so that's a good alternative until we can make the page editor coexist with components written in ExtJs.