
The JS engine includes many features related to AJAX. Some are specific to Elgg, and some extend jQuery's native AJAX features.
Wrapper for jQuery's $.ajax(), but forces GET and does URL normalization. Accepts all standard jQuery options.
Example:
// normalizes the url to the current <site_url>/activity elgg.get('/activity', { success: function(resultText, success, xhr) { console.log(resultText); } });
Wrapper for jQuery's $.ajax(), but forces POST and does URL normalization. Accepts all standard jQuery options.
Calls an Elgg action with the data passed. This handles outputting of system messages and errors.
Example:
elgg.action('friend/add', { data: { friend: 1234 }, success: function(json) { // do something } });