Returning a JSON Array for Ajax
Release 1.0 - ...
The JSON macro is ideal for creating structures to pass to the client in Ajax scenarios.
In this example, a simple string array is returned to the client as a JSON response for XmlHttpRequest (Ajax) calls:
Smartsite SXML | Copy Code |
---|---|
<se:json id="array">{ "words":[] } </se:json> <se:sitemap startitem="2" maxlevels="10" rowformat="{page.array.add(words, this.field(title), 'string')}" /> {page.setforcedresult( string.xmldecode(page.array.get(words, true, default='null', error='null')), page.array.mimetype())} |
Renders a JSON notation array like this:
Copy Code | |
---|---|
[ "Behavior", "Cool Form", "Drag & Drop!", "TV Channel", "Example of an implementation", "ListView", "TabStrip", "Upload files", "ASP.NET Integration", (.......) "Page Cache", "Event Calendar", "Tag Cloud", "Browse by tag", "Faceted search" ] |