Sends an HTTP request to the server.
Optional
url: null | stringThe URL of the resource on the server. Can be a relative or absolute URL.
Optional
settings: IxAjaxSettingsAn optional settings object that configures the Ajax request.
A jQuery Deferred object that represents the state of the Ajax request. This object can be used to attach additional callback functions that will be executed when the request is complete.
// Example usage: Sending a GET request to a server endpoint and logging the response
ix.api.request.ajax().request('http://example.com/api/data', {
dataType: 'json',
urlParameters: {
param1: 'value1',
param2: 'value2'
}
}).done(function(data) {
console.log(data);
});
Request a Groovy file, stored in the current application.
Path to a groovy file started after application/${application.guid}/groovy/
.
An optional settings object that configures the Ajax request.
Optional
appContext: IxControl | HTMLElementElement object represents an HTML element.
ix.api.request.ajax().requestAppGroovy('newGuid.groovy', {
dataType: "json",
data: {
"hello": "world!"
},
success: function (data) {
Notifier.status.notify(data.guids.join("<br>"));
}
}, ix.api.dom.getHtml("<GUID>"));
Request a groovy file.
Path to a groovy file (should be in the portal groovy directory: <portal>/groovy
).
An optional settings object that configures the Ajax request.
ix.api.request.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 information (request params e.g. rq_AppGuid
and form fields) to the current ix.Ajax
object.
Element object represents an HTML element or Intrexx control.
var ixAjax = ix.api.request.ajax();
ixAjax.setAppContext(ix.api.dom.getHtml("<GUID>"));
ixAjax.requestGroovy('groovy/de/uplanet/lucy/samples/newGuid.groovy', {
data: {
"hello": "world!"
},
success: function (data) {
Notifier.status.notify(data.guids.join("<br>"));
}
});
This wrapper class provides a set of methods to perform asynchronous HTTP (Ajax) requests.
IMPORTANT
It is recommended to use the static ajax method instead of creating a new instance of
ix.Ajax
for better support of updates.Example