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

IMPORTANT

Please use static ajax instead of new ix.Ajax() for better update support!

Hierarchy

  • Ajax

Methods

  • Send a request to the server.

    Parameters

    • Optional url: null | string

      The location of the file on the server.

    • Optional settings: IxAjaxSettings

      Ajax settings e.g. {dataType: 'json', urlParameters: {}}

    Returns Deferred<any, any, any> | jqXHR<any>

    jQuery Deferred object

  • Request a groovy file, stored in the current application.

    Parameters

    • groovyFile: string

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

    • settings: IxAjaxSettings

      Ajax settings e.g. {dataType: 'json', urlParameters: {}}.

    • Optional appContext: UpObject | HTMLElement

      Element object represents an HTML element.

    Returns Deferred<any, any, any>

    jQuery Deferred object

    Example

    ix.ajax().requestAppGroovy('newGuid.groovy', {
    dataType: "json",
    data: {
    "hello": "world!"
    },
    success: function (data) {
    Notifier.status.notify(data.guids.join("<br>"));
    }
    }, ix.util.getHtml("<GUID>"));
  • Request a groovy file.

    Parameters

    • groovyFile: string

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

    • settings: IxAjaxSettings

      Ajax settings e.g. {dataType: 'json', urlParameters: {}}.

    Returns Deferred<any, any, any> | jqXHR<any>

    jQuery Deferred object

    Example

    ix.ajax().requestGroovy('groovy/de/uplanet/lucy/samples/newGuid.groovy', {
    dataType: "json",
    data: {
    "hello": "world!"
    },
    success: function (data) {
    Notifier.status.notify(data.guids.join("<br>"));
    }
    });
  • Add the current application page context informations (Request-Params e.g. rq_AppGuid and form fields) to the current ix.Ajax object.

    Parameters

    • element: UpObject | HTMLElement

      Element object represents an HTML element.

    Returns Deferred<any, any, any> | Ajax

    jQuery Deferred object

    Example

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