Class: Ajax

ix. Ajax

new Ajax(settings)

Helper Class to perform specific asynchronous HTTP (Ajax) request.

Please use static ix.ajax() instead of new ix.Ajax() for better update support.
Parameters:
Name Type Description
settings Object

Ajax settings e.g. {dataType: 'json'}, http://api.jquery.com/jQuery.ajax/, additional intrexx properties: urlParameters

See:

Methods

requestAppGroovy(groovyFile, settings, appContext) → {Deferred}

Request a groovy file, stored in the current application.

Parameters:
Name Type Description
groovyFile String

Path to a groovy file started after application/${application.guid}/groovy/

settings Object

Ajax settings e.g. {dataType: 'json'}, http://api.jquery.com/jQuery.ajax/, additional intrexx properties: urlParameters

appContext HTMLElement | Object

Element object represents an HTML element.

Returns:
Type
Deferred
Example
ix.ajax().requestAppGroovy('newGuid.groovy', {
    dataType: "json",
    data: {
        "hello": "world!"
    },
    success: function (data) {
        Notifier.status.notify(data.guids.join("<br>"))
    }
}, getElement("E1B3435F15335CCD4A3E7E0F8CBEEFE9F1E2B593"));

requestGroovy(groovyFile, settings) → {Deferred}

Request a groovy file.

Parameters:
Name Type Description
groovyFile String

Path to a groovy file (should be in the portal groovy directory: /groovy)

settings Object

Ajax settings e.g. {dataType: 'json'}, http://api.jquery.com/jQuery.ajax/, additional intrexx properties: urlParameters

Returns:
Type
Deferred
Example
var ixAjax = ix.ajax();
ixAjax.requestGroovy('groovy/de/uplanet/lucy/samples/newGuid.groovy', {
dataType: "json",
    data: {
        "hello": "world!"
    },
    success: function (data) {
        Notifier.status.notify(data.guids.join("<br>"))
    }
});

setAppContext(appContext) → {ix.Ajax}

Add the current application page context informations (Request-Params e.g. rq_AppGuid and Form-Fields) to the current ix.Ajax object.

Parameters:
Name Type Description
appContext HTMLElement | Object

Element object represents an HTML element.

Returns:
Type
ix.Ajax
Example
var ixAjax = ix.ajax();
ixAjax.setAppContext(getElement("E1B3435F15335CCD4A3E7E0F8CBEEFE9F1E2B593"));
ixAjax.requestGroovy('groovy/de/uplanet/lucy/samples/newGuid.groovy', {
    data: {
        "hello": "world!"
    },
    success: function (data) {
        Notifier.status.notify(data.guids.join("<br>"))
    }
});