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


<static> serializeArray(settings)

Returns a set of form elements as an array of names and values.

Parameters:
Name Type Description
settings ix.Ajax~SerializeSettings
To Do:
  • only send input element of type button/submit if button was clicked or represents default submit action
Returns:
Type
Array

requestAppGroovy(groovyFile, settings, appContext)

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)

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)

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>"))
    }
});

Type Definitions


SerializeSettings

Type:
  • Object
Properties:
Name Type Argument Description
containerNode Element <optional>

An container element in the Document Object Model (DOM).

selector Selector <optional>

A string containing a selector expression to match elements against.

filter function <optional>

A function used as a test for each element in the set. Within the filter function, this refers to each DOM element in turn.