Use the apex.server namespace to store all AJAX functions to communicate with the server part of Oracle Application Express.
Topics:
This function calls the PL/SQL AJAX function which has been defined for a plug-in. This function is a wrapper of the jQuery.ajax function and supports all the settings the jQuery function provides, with additional Application Express specific features.
Parameters
Return Values
| Type | Description |
|---|---|
|
{Object} |
Retuns a jqXHR object. See Also: See the jQuery documentation for more details on this object: |
Example
This call to apex.server.plugin sets the scalar value x01 to test (which can be accessed from PL/SQL using apex_application.g_x01) and sets the page item's P1_DEPTNO and P1_EMPNO values in session state (using jQuery selector syntax). The P1_MY_LIST item is used as the element for which the apexbeforerefresh and apexafterrefresh events are fired. P1_MY_LIST is used as the element for which to display the loading indicator next to. The success callback is stubbed out and is used for developers to add their own code that fires when the call successfully returns.
The pData parameter to the success callback will contain any response sent from the call.
apex.server.plugin ( lAjaxIdentifier, {
x01: "test",
pageItems: "#P1_DEPTNO,#P1_EMPNO"
}, {
refreshObject: "#P1_MY_LIST",
loadingIndicator: "#P1_MY_LIST",
success: function( pData ) { ... do something here ... }
} );
This function returns the URL to issue a GET request to the PL/SQL AJAX function which has been defined for a plug-in.
Parameters
|
Table 23-12 apex.server.pluginUrl( pAjaxIdentifier, pData) Parameters
|
Return Value
Example
This call to apex.server.pluginUrl returns a URL to issue a GET request to the PL/SQL AJAX function which has been defined for a plug-in, where the URL sets the scalar value x01 to test (which can be accessed from PL/SQL using apex_application.g_x01) and will also set the page item's P1_DEPTNO and P1_EMPNO values in session state (using jQuery selector syntax).
var lUrl;
lUrl = apex.server.pluginUrl ( pAjaxIdentifier, {
x01: "test",
pageItems: "#P1_DEPTNO,#P1_EMPNO" } );
This function calls a PL/SQL on-demand process defined on page or application level. This function is a wrapper of the jQuery.ajax function and supports all the setting the jQuery function provides but provides additional Application Express features.
Parameters
Table 23-14 apex.server.process Parameters
| Name | Type | Optional/ Required | Default | Description |
|---|---|---|---|---|
|
|
(String) |
Required |
Use the value returned by the PL/SQL package |
|
|
|
{Object} |
Optional |
Object which can optionally be used to send additional values to be sent with the AJAX request. The special attribute |
|
|
|
{Object} |
Optional |
Object which can optionally be used to set additional options used by the AJAX. It supports the following optional Application Express specific attributes:
function( pLoadingIndicator ) {
return lLoadingIndicator.prependTo ( apex.jQuery(
"td.shuttleControl", gShuttle ))
}
See Also: See jQuery documentation of See the jQuery documentation for more details on this object: |
Return Values
| Type | Description |
|---|---|
|
{Object} |
Returns a jqXHR object. See the jQuery documentation for more details on this object: |
Example
This call to apex.server.process calls an on-demand process called MY_PROCESS and sets the scalar value x01 to test (which can be accessed from PL/SQL using apex_application.g_x01) and sets the page item's P1_DEPTNO and P1_EMPNO values in session state (using jQuery selector syntax). The success callback is stubbed out so that developers can add their own code that fires when the call successfully returns.
Note: The pData parameter to the success callback contains any response sent from the call.
apex.server.process ( "MY_PROCESS", {
x01: "test",
pageItems: "#P1_DEPTNO,#P1_EMPNO"
}, {
success: function( pData ) { ... do something here ... }
} );