The Oracle Application Express 4.2 (APEX 4.2) is a fast Web application development tool. Ajax requests are sometimes used in the process of developing Web pages.
How to create an AJAX request:
1. Set up the background processing:
Step 1
Step 2
Step 3
This completes the creation of the background processing.
2. Compile JS at the front desk:
function ajaxtest () { apex.server.process (' TEST ',/// Background processing name, case sensitive {},// The parameter to pass { dataType:' text ', success:function(data) { Console.log (data);}} );} Ajaxtest ();
The console will then output Hello world.
Ps:
If you want to pass parameters, you can do this:
Apex.server.process (' TEST ',// Background processing name, case sensitive { /// X01-X10 is a public variable that is built into apex and can pass a generic string. x01: ' param1 ', x02:' param2 ', ... X10:' PARAM10 ', // If you want to pass a lot of variables, the type is consistent, you can use the array f01:[' param1 ', ' Param2 ',...], f02:[...] }, { dataType:' text ', success: function(data) { console.log (data); } } );
Plsql references in background processing
DECLAREvarchar2( varchar2); begin l_str1:=apex_application.g_x01; L_STR2:=apex_application.g_f01 (1); -- Note that the start of the plsql number is 1 End;
Ajax calls in Oracle application Express (APEX 4.2)