2 elgg.provide(
'elgg.ajax');
20 options =
elgg.ajax.handleOptions(
url, options);
22 options.url =
elgg.normalize_url(options.url);
23 return $.ajax(options);
43 elgg.ajax.handleOptions =
function(
url, options) {
50 options = options || {};
59 if (
elgg.isFunction(options)) {
68 for (member in options) {
70 if (
elgg.isFunction(options[member])) {
79 options = {data: data};
97 options =
elgg.ajax.handleOptions(
url, options);
100 return elgg.ajax(options);
111 options =
elgg.ajax.handleOptions(
url, options);
113 options.dataType =
'json';
114 return elgg.get(options);
125 options =
elgg.ajax.handleOptions(
url, options);
127 options.type =
'post';
128 return elgg.ajax(options);
184 if (
action.indexOf(
'action/') < 0) {
188 options =
elgg.ajax.handleOptions(
action, options);
192 if (!
elgg.isString(options.data) || options.data.indexOf(
'__elgg_ts') == -1) {
193 options.data =
elgg.security.addToken(options.data);
195 options.dataType =
'json';
198 var custom_success = options.success ||
elgg.nullFunction;
199 options.success =
function(json, two, three, four) {
200 if (json && json.system_messages) {
201 elgg.register_error(json.system_messages.error);
202 elgg.system_message(json.system_messages.success);
205 custom_success(json, two, three, four);
208 return elgg.post(options);
227 elgg.api =
function (method, options) {
228 elgg.assertTypeOf(
'string', method);
235 options =
elgg.ajax.handleOptions(method, options);
236 options = $.extend(defaults, options);
238 options.url =
'services/api/rest/' + options.dataType +
'/';
239 options.data.method = method;
241 return elgg.ajax(options);
elgg message elgg state success
$CONFIG url
The full URL where Elgg is installed.