Some comments:
For step 1: Don't print the JSON directly. You'll have escaping
issues. In order to ensure the generated JSON is valid you should
build the JSON in memory (using Velocity/Java maps, arrays and basic
types) and then serialize it:
$jsontool.serialize({
greeting: Hello,
location: World
})
For step 4: Don't hard-code the page URL and use the 'get' action
instead of 'view' to avoid adding view statistics entries.
var url = new XWiki.Document('JsonHello', 'Sandbox').getURL('get');
Also, to avoid the need to URL-encode the request parameters you
should pass them using an object not a string.
var params = {
'xpage': 'plain',
'outputSyntax': 'plain'
};
$.get(url, params, function(data) {
...
});
Hope this helps,
Marius
On Fri, Mar 20, 2015 at 8:26 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote:
Hello,
Here, I provided an simple Ajax example to use in xwiki application:
http://extensions.xwiki.org/xwiki/bin/view/Extension/AJAX+example#Attachments
This mail on this list to validate that what I wrote is the best way (like
suggest Vincent)
Thxs.
Pascal BASTIEN
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users