5 Replies Latest reply on Apr 28, 2014 11:23 PM by Sai6896

    Success Message through Javascript Function



      I have an Ajax call to call a Process Like this

      var ajaxRequest = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ProcessName',10);

       ajaxResult = ajaxRequest.get();

        if (ajaxResult == 'Success')







      So when ajaxResult is "Success" i need to redirect to an other page and Show Some Success Notification there ,Something like "Action Processed" in the Success Message Notification area


      Can anyone help me out in this please.



        • 1. Re: Success Message through Javascript Function
          Jorge Rimblas


          The code looks fine, what exactly is the problem?


          Is your PL/SQL returning Success via an htp.prn call?

          If you do htp.p('Succes'); then you actually get a new line character included and (ajaxResult == 'Success') will never be true.

          Try htp.prn instead.




          • 2. Re: Success Message through Javascript Function

            Hi Jorge,


            My problem here is im redirecting to other page successfully but i need to show the Success message Like "Action Processed." in that redirected page.


            usally when its a regular on submit PLSQL process, we can create a branching and say include success message , but since this is an on demand ajax call process hwo to include success message??




            • 3. Re: Success Message through Javascript Function
              Jorge Rimblas

              Hi Sai,

              I' struggling with the fact that what you're describing is exactly what APEX does natively with no hassles if you place your AJAX code in a Process and then branch to a new page on success.

              Why do you need the AJAX process in this case?


              That said, once you start replicating native behavior on your own you need to keep on adding more and more code.  So here are some ideas:

              * If you ONLY arrive at p88 after success then add a region to your page that has the same HTML as the Success message of your page template.  For example, for Theme 25, my HTML content would look something like this:

              <div class="apex_grid_container">

                <div class="apex_cols apex_span_12">

                  <section class="uMessageRegion successMessage clearfix" id="uSuccessMessage">

                    <div class="uRegionContent clearfix">

                      <a href="javascript:void(0)" onclick="apex.jQuery('#uSuccessMessage').remove();" class="uCloseMessage"><span class="visuallyhidden">#CLOSE_NOTIFICATION#</span></a>

                      <img src="#IMAGE_PREFIX#f_spacer.gif" class="uCheckmarkIcon" alt="" />

                      <div class="uMessageText">

                        Action Processed







              Of course you could make it conditional.  For example, only show it with a specific request value.  Lest say SUCCESS.  Then your redirect after the AJEX call would look like this:


              Then the region only shows when the arriving request is success.


              * You could also inject the success message HTML via javascript.  But again, that gets messy.




              • 4. Re: Success Message through Javascript Function

                Hi your code looks ok, but exatcly what is the application process doing?? Besides who do u trigger this success in the first place?

                Thanks Benjamin

                • 5. Re: Success Message through Javascript Function

                  Thank you Jorge.