Oracle Application Express (APEX 4.2) for ajax calls, apexajax
Oracle Application Express 4.2 (APEX 4.2) is a quick web Application development tool. Ajax requests are sometimes used during web page development.
How to create an ajax request:
1. Create background processing:
Step 1
Step 2
Step 3
In this way, the background processing is completed.
2. Compile js on the frontend:
Function ajaxTest () {apex. server. process ('test', // name of the background processing, case sensitive {}, // parameter to be passed {ype: 'text', success: function (data) {console. log (data) ;}}) ;}ajaxtest ();
In this way, the console outputs hello world.
PS:
If you want to pass parameters, you can do this:
Apex. server. process ('test', // name of the background processing, case sensitive {// The x01-x10 is a public variable built into apex that can pass a general string. X01: 'param1', x02: 'param2 ',... x10: 'param10', // if there are many variables to be passed and the types are the same, you can use the array f01: ['param1', 'param2',...], f02: [...]}, {dataType: 'text', success: function (data) {console. log (data );}});
Plsql reference in background processing
Declarel_str1 varchar2 (20); l_str2 varchar2 (20); begin l_str1: = apex_application.g_x01; l_str2: = apex_application.g_f01 (1); -- note that plsql numbers start with 1 end;