Developing the Javascript Client: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Some quick hints == === Ajax calls === * We are using the axios library for ajax calls: https://github.com/axios/axios * We have our own wrapper around it: https://github.c...") |
|||
Line 2: | Line 2: | ||
=== Ajax calls === | === Ajax calls === | ||
* We are using the axios library for ajax calls: https://github.com/axios/axios | * We are using the axios library for ajax calls: https://github.com/axios/axios | ||
* We have our own wrapper around it: https://github.com/openpetra/openpetra | * We have our own wrapper around it: https://github.com/openpetra/openpetra/blob/master/js-client/src/lib/ajax.js#L31 | ||
* We make calls to the API, as it is available here: https://demo.openpetra.org/api/ | * We make calls to the API, as it is available here: https://demo.openpetra.org/api/ | ||
* We want the result formatted as JSON. This only works with post, not with get, and with at least an empty list of parameters. Otherwise you get the result formatted in XML. | * We want the result formatted as JSON. This only works with post, not with get, and with at least an empty list of parameters. Otherwise you get the result formatted in XML. |
Latest revision as of 20:38, 11 Mayıs 2022
Some quick hints
Ajax calls
- We are using the axios library for ajax calls: https://github.com/axios/axios
- We have our own wrapper around it: https://github.com/openpetra/openpetra/blob/master/js-client/src/lib/ajax.js#L31
- We make calls to the API, as it is available here: https://demo.openpetra.org/api/
- We want the result formatted as JSON. This only works with post, not with get, and with at least an empty list of parameters. Otherwise you get the result formatted in XML.
Example:
api.post('serverMSysMan.asmx/TMaintenanceWebConnector_LoadUsersAndModulePermissions', {}) .then(function(response) { ...