JavaScript

{dialog.object}.ajaxCallback Method

Syntax

{dialog.object}.ajaxCallback(part,rowNum,XbasicFunction [,callbackURL [,additionalData [, options]]]);

Arguments

partstring

In a grid component, part indicates the Grid part (Search, Grid, or Detail View) from which data should be submitted. In a UX Component, this parameter is not used and should be an empty string.

rowstring

In a grid component, row indicates the Grid row from which data should be submitted. In a UX Component, this parameter is not used and should be an empty string.

XbasicFunctionstring

The name of the Xbasic function you want to call on the server.

callbackURLstring

Default = "". This parameter is almost always set to a blank string. It can be used to specify the URL you want to call to handle the callback. For example, you could call a .php, or .asp page to handle the callback. If this value is not blank then the setting for XbasicFunction is ignored.

additionalDatastring

Default = "". Any additional data you want to submit. The data in the controls on the UX Component is automatically submitted. This can be used to submit additional data. Specify a string of name/value pairs. e.g. 'data1=value1&data2=value2'

optionsobject

An object with one or more additional options. Available options include:

ajaxCallbackTimeoutnumber

The length of time in milliseconds to wait until the callback times out.

onCompletefunction

A function that will be called when the operation completes.

errorFunctionfunction

A function that will be called if an error occurs.

deviceOfflineFunctionfunction

A funciton that will be called if the device is offline and the callback cannot be performed.

Description

Does an Ajax callback to a server.

Example

{dialog.object}.ajaxCallback('','','myAjaxCallback1','','data1=value1&data2=value2');

Data from the UX Component is submitted to the server. It is recommended that you use Action Javascript to write the code for you. This can be done by creating an Ajax Callback Action either as a Javascript Action or as Action Javascript for a control's event.

The method has several blank arguments in order to keep the method prototype the same as for the Grid component.

See Also