Elgg  Version 1.9
Functions | Variables
ajax.js File Reference

Go to the source code of this file.

Functions

elgg provide ('elgg.ajax')
 

Variables

elgg ajax
 Wrapper function for jQuery.ajax which ensures that the url being called is relative to the elgg site root. More...
 
elgg ajax SUCCESS = 0
 
elgg ajax ERROR = -1
 
elgg get
 Wrapper function for elgg.ajax which forces the request type to 'get. More...
 
elgg getJSON
 Wrapper function for elgg.get which forces the dataType to 'json. More...
 
elgg post
 Wrapper function for elgg.ajax which forces the request type to 'post. More...
 
elgg action
 
elgg api
 

Function Documentation

elgg provide ( 'elgg.ajax )

Variable Documentation

Definition at line 178 of file ajax.js.

elgg ajax
Initial value:
= function(url, options) {
options = elgg.ajax.handleOptions(url, options);
options.url = elgg.normalize_url(options.url);
return $.ajax(options);
}
elgg
Definition: install.js:23
$CONFIG url
The full URL where Elgg is installed.
Definition: config.php:94

Wrapper function for jQuery.ajax which ensures that the url being called is relative to the elgg site root.

Author
Evan Winslow Provides a bunch of useful shortcut functions for making ajax calls

You would most likely use elgg.get or elgg.post, rather than this function

Parameters
{string}url Optionally specify the url as the first argument
{Object}options Optional. jQuery#ajax
Returns
{XmlHttpRequest}

Definition at line 19 of file ajax.js.

elgg api
Initial value:
= function (method, options) {
elgg.assertTypeOf('string', method);
var defaults = {
dataType: 'json',
data: {}
};
options = elgg.ajax.handleOptions(method, options);
options = $.extend(defaults, options);
options.url = 'services/api/rest/' + options.dataType + '/';
options.data.method = method;
return elgg.ajax(options);
}
elgg
Definition: install.js:23

Definition at line 227 of file ajax.js.

elgg ajax ERROR = -1

Definition at line 33 of file ajax.js.

elgg get
Initial value:
= function(url, options) {
options = elgg.ajax.handleOptions(url, options);
options.type = 'get';
return elgg.ajax(options);
}
elgg
Definition: install.js:23
$CONFIG url
The full URL where Elgg is installed.
Definition: config.php:94

Wrapper function for elgg.ajax which forces the request type to 'get.

'

Parameters
{string}url Optionally specify the url as the first argument
{Object}options jQuery#ajax
Returns
{XmlHttpRequest}

Definition at line 96 of file ajax.js.

elgg getJSON
Initial value:
= function(url, options) {
options = elgg.ajax.handleOptions(url, options);
options.dataType = 'json';
return elgg.get(options);
}
elgg
Definition: install.js:23
$CONFIG url
The full URL where Elgg is installed.
Definition: config.php:94

Wrapper function for elgg.get which forces the dataType to 'json.

'

Parameters
{string}url Optionally specify the url as the first argument
{Object}options jQuery#ajax
Returns
{XmlHttpRequest}

Definition at line 110 of file ajax.js.

elgg post
Initial value:
= function(url, options) {
options = elgg.ajax.handleOptions(url, options);
options.type = 'post';
return elgg.ajax(options);
}
elgg
Definition: install.js:23
$CONFIG url
The full URL where Elgg is installed.
Definition: config.php:94

Wrapper function for elgg.ajax which forces the request type to 'post.

'

Parameters
{string}url Optionally specify the url as the first argument
{Object}options jQuery#ajax
Returns
{XmlHttpRequest}

Definition at line 124 of file ajax.js.

elgg ajax SUCCESS = 0

Definition at line 28 of file ajax.js.