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!

How to make AJAX Call wait till Procedure is complete?

Veerendra PatilNov 28 2019 — edited Nov 28 2019

Hi ,

I am using APEX 19.1, DB 12

I have an AJAX call process on button Click

function saveDetails(pID, pColumnVal) {

var lSpinner$ = apex.util.showSpinner($("#regionStaticID"));

apex.server.process("SAVE_DETAILS", {

            x01: pID,

            x02: pColumnVal

        }, {

            //pageItems: ''

            dataType: 'text'

        }).done(function(pData) {

            console.log("Calling DB OVer - " + pData);

            lSpinner$.remove();

            apex.region("regionStaticID").refresh();

        });

}

SAVE_DETAILS Process is

BEGIN

myProc (apex_application.g_x01, apex_application.g_x02);

htp.p('OK');

END;

The process calls a DB procedure. The procedure is doing some calculations and it takes around 5-10 secs to complete.

But, the AJAX call is not waiting for process to complete even though I have Refresh Region part in .done.

The region is getting refreshed without the changes. The changes are saved correctly and when I refresh Page, I can see the changes done correctly.

How do fix this?

Please suggest.

Thanks,

Veerendra.

Comments
Post Details
Added on Nov 28 2019
4 comments
1,449 views