Common AJAX requests

To devs,

I have implemented actions for the most common AJAX responses in dhis-web-commons/-resources with both XML and JSON responses. The idea is that instead of implementing these actions all over the system it makes sense to have it one place. So next time you need an AJAX response please check if what you need is already there. One can also in many cases simplify GUI development by populating the page with DOM/Javascript/XHRs after the view has been rendered as one can avoid writing Java action classes.

The XML requests are in the “dhis-web-commons-ajax” namespace and the JSON requests are in the “dhis-web-commons-ajax-json” namespace. The complete list so far:

getDataElement.action
getDataElements.action

getDataSet.action
getDataSets.action
getIndicator.action
getIndicators.action
getOrganisationUnit.action
getOrganisationUnits.action
getOrganisationUnitChildren.action
getPeriod.action
getPeriods.action

So if you need a DataElement with XML response one would do:

…/dhis-web-commons-ajax/getDataElement.action?id=10

and for JSON:

…/dhis-web-commons-ajax-json/getDataElement.action?id=10

regards Lars