Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

What's the response from an Ajax Callback?

Eric Olson 1Jan 29 2021

I'm invoking a piece of PL/SQL via a button and a Dynamic Action of type Execute JavaScript code and apex.server.process(). The call to process() returns a Promise with done() and fail() methods. I have no problem with any of that. I just can't figure out what the response from the PL/SQL is supposed to be.
For example, if my PL/SQL source is:

begin
    raise_application_error(-20001, 'Intentional error');
end;

The actual response is "sqlerrm:ORA-20001: Intentional error" and Apex displays an error "SyntaxError: Unexpected token s in JSON at position 0". It's trying to parse the response as JSON and failing, so it's expecting some JSON response.
I assumed it would use the Success Message and Error Message in the Ajax Callback definition, but those seem to be ignored.
What am I supposed to be outputting from my PL/SQL and how does the Promise returned by process() know how to call the done or fail method?

Comments
Post Details
Added on Jan 29 2021
1 comment
4,414 views