1 Reply Latest reply: Apr 25, 2014 1:24 PM by Mindmap RSS

    Submit form - not a page

    Mindmap

      Hello All,

       

      How can I submit the form below ( outside APEX ) without submitting the page.

       

      The Action in the below form has RESTful POST method. Its PL/SQL Source is :

       

      insert into emp ( empno , ename )

      values

      (DEMO_USERS_SEQ.nextval , :ENAME)

       

      e.g of consuming that API :

       

        http://s22.postimg.org/79wp8rbv5/Capture.png

       

      ----------------------------------------------------------------

      So, I have this static page. I need to submit the form to Oracle DB without the page gets submitted. Any idea about that ?

      <html>

      <head>

      </head>

      <body>

          <form action= "https://apex.oracle.com/pls/apex/somefeto/hr/emp/" method="POST">

             Employee: <input type="text" name="ENAME">

              <input class="button" type="submit" value="Submit" />

          </form>

      </body>

      </html>

        • 1. Re: Submit form - not a page
          Mindmap
          
          <html>
          <head>
          <!-- jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license -->
          
          
          <script  src="jquery.js"></script>
          <script>
           $(document).ready(function() {
              $("#submit-form-button").click(function() { submitForm(); });
          });
          function submitForm() {
          var x = $("#ENAME").val();
              $.ajax({
                type: "POST",
                url: "https://apex.oracle.com/pls/apex/somefeto/hr/emp/",
                data: {  ENAME:  x },
                success: function() {
                   alert("FORM SUBMITTED!");
                },
                dataType: 'html'
              });
          };
          </script>
          </head>
          <body>
              <form action= "https://apex.oracle.com/pls/apex/somefeto/hr/emp/" method="POST">
                 Employee: <input id="ENAME" type="text" name="ENAME">
                  <a href="#" id="submit-form-button">SUBMIT</a> 
              </form>
          
          
          </body>
          </html>