Submit form and stay on same page with target='_top' The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceXMLHttpRequest cannot load XXX No 'Access-Control-Allow-Origin' headerJavaScript post request like a form submitTwo submit buttons in one formHow do you overcome the html form nesting limitation?How to submit form data use jquery form in asp.net?Prevent users from submitting a form by hitting EnterHow to prevent buttons from submitting formsjQuery AJAX submit formAngularJS does not send hidden field valueUnable to send parameters to servlet on form submit through javascriptNot able to submit a form to the action

Am I ethically obligated to go into work on an off day if the reason is sudden?

One-dimensional Japanese puzzle

Do warforged have souls?

Mortgage adviser recommends a longer term than necessary combined with overpayments

Single author papers against my advisor's will?

Does Parliament need to approve the new Brexit delay to 31 October 2019?

Homework question about an engine pulling a train

Deal with toxic manager when you can't quit

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?

Loose spokes after only a few rides

What can I do if neighbor is blocking my solar panels intentionally?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Is this wall load bearing? Blueprints and photos attached

What information about me do stores get via my credit card?

What do I do when my TA workload is more than expected?

What's the point in a preamp?

"... to apply for a visa" or "... and applied for a visa"?

How do you keep chess fun when your opponent constantly beats you?

Is 'stolen' appropriate word?

Working through the single responsibility principle (SRP) in Python when calls are expensive

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

Can withdrawing asylum be illegal?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?



Submit form and stay on same page with target='_top'



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceXMLHttpRequest cannot load XXX No 'Access-Control-Allow-Origin' headerJavaScript post request like a form submitTwo submit buttons in one formHow do you overcome the html form nesting limitation?How to submit form data use jquery form in asp.net?Prevent users from submitting a form by hitting EnterHow to prevent buttons from submitting formsjQuery AJAX submit formAngularJS does not send hidden field valueUnable to send parameters to servlet on form submit through javascriptNot able to submit a form to the action



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Here is my form on domain1:



<form id ='myForm' action='domain2' method='GET' target='_top'>
<input type='hidden' name='id' value='00345897'>
<input type='hidden' name='status' value='Success'>
<input type="submit" value="Submit">
</form>


Now when I submit my form it goes to the domain2 as mentioned in the action. Is it possible to get the response back to domain1? I am getting the response if the target attribute is '_self' or if I remove the target attribute. But with target='_top' the page is redirected to domain2. How can I get the response back to domain1? Thanks.










share|improve this question






























    0















    Here is my form on domain1:



    <form id ='myForm' action='domain2' method='GET' target='_top'>
    <input type='hidden' name='id' value='00345897'>
    <input type='hidden' name='status' value='Success'>
    <input type="submit" value="Submit">
    </form>


    Now when I submit my form it goes to the domain2 as mentioned in the action. Is it possible to get the response back to domain1? I am getting the response if the target attribute is '_self' or if I remove the target attribute. But with target='_top' the page is redirected to domain2. How can I get the response back to domain1? Thanks.










    share|improve this question


























      0












      0








      0








      Here is my form on domain1:



      <form id ='myForm' action='domain2' method='GET' target='_top'>
      <input type='hidden' name='id' value='00345897'>
      <input type='hidden' name='status' value='Success'>
      <input type="submit" value="Submit">
      </form>


      Now when I submit my form it goes to the domain2 as mentioned in the action. Is it possible to get the response back to domain1? I am getting the response if the target attribute is '_self' or if I remove the target attribute. But with target='_top' the page is redirected to domain2. How can I get the response back to domain1? Thanks.










      share|improve this question
















      Here is my form on domain1:



      <form id ='myForm' action='domain2' method='GET' target='_top'>
      <input type='hidden' name='id' value='00345897'>
      <input type='hidden' name='status' value='Success'>
      <input type="submit" value="Submit">
      </form>


      Now when I submit my form it goes to the domain2 as mentioned in the action. Is it possible to get the response back to domain1? I am getting the response if the target attribute is '_self' or if I remove the target attribute. But with target='_top' the page is redirected to domain2. How can I get the response back to domain1? Thanks.







      javascript forms rest jsp servlets






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 13:20









      Egon Allison

      8381419




      8381419










      asked Mar 8 at 12:18









      Bhargav MadiaBhargav Madia

      162




      162






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The response can't go anywhere other than to the browser making the response.



          If you don't specify a target, then it will appear in the same window or frame as the page with the form on it (replacing the page with the form on it).



          If you specify target="_top" then it will appear in the top-level frame replacing that.



          If you want to get the data to the site making the request then you need to either:



          • Make the HTTP request from domain1's server and not from a browser or

          • Use Ajax to make the request to domain1 (dealing with cross origin issues) and then use JavaScript to send the data to domain1.





          share|improve this answer























          • Thanks for the reply, but in my case this form is dynamically generated, so doing ajax call is not possible from domain1. You mentioned that the response will appear in the top level frame, now can i get this response back to the domain1 using javascript? I tried with parent.psotMessage but that didn't work.

            – Bhargav Madia
            Mar 11 at 7:12












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063095%2fsubmit-form-and-stay-on-same-page-with-target-top%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The response can't go anywhere other than to the browser making the response.



          If you don't specify a target, then it will appear in the same window or frame as the page with the form on it (replacing the page with the form on it).



          If you specify target="_top" then it will appear in the top-level frame replacing that.



          If you want to get the data to the site making the request then you need to either:



          • Make the HTTP request from domain1's server and not from a browser or

          • Use Ajax to make the request to domain1 (dealing with cross origin issues) and then use JavaScript to send the data to domain1.





          share|improve this answer























          • Thanks for the reply, but in my case this form is dynamically generated, so doing ajax call is not possible from domain1. You mentioned that the response will appear in the top level frame, now can i get this response back to the domain1 using javascript? I tried with parent.psotMessage but that didn't work.

            – Bhargav Madia
            Mar 11 at 7:12
















          1














          The response can't go anywhere other than to the browser making the response.



          If you don't specify a target, then it will appear in the same window or frame as the page with the form on it (replacing the page with the form on it).



          If you specify target="_top" then it will appear in the top-level frame replacing that.



          If you want to get the data to the site making the request then you need to either:



          • Make the HTTP request from domain1's server and not from a browser or

          • Use Ajax to make the request to domain1 (dealing with cross origin issues) and then use JavaScript to send the data to domain1.





          share|improve this answer























          • Thanks for the reply, but in my case this form is dynamically generated, so doing ajax call is not possible from domain1. You mentioned that the response will appear in the top level frame, now can i get this response back to the domain1 using javascript? I tried with parent.psotMessage but that didn't work.

            – Bhargav Madia
            Mar 11 at 7:12














          1












          1








          1







          The response can't go anywhere other than to the browser making the response.



          If you don't specify a target, then it will appear in the same window or frame as the page with the form on it (replacing the page with the form on it).



          If you specify target="_top" then it will appear in the top-level frame replacing that.



          If you want to get the data to the site making the request then you need to either:



          • Make the HTTP request from domain1's server and not from a browser or

          • Use Ajax to make the request to domain1 (dealing with cross origin issues) and then use JavaScript to send the data to domain1.





          share|improve this answer













          The response can't go anywhere other than to the browser making the response.



          If you don't specify a target, then it will appear in the same window or frame as the page with the form on it (replacing the page with the form on it).



          If you specify target="_top" then it will appear in the top-level frame replacing that.



          If you want to get the data to the site making the request then you need to either:



          • Make the HTTP request from domain1's server and not from a browser or

          • Use Ajax to make the request to domain1 (dealing with cross origin issues) and then use JavaScript to send the data to domain1.






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 13:29









          QuentinQuentin

          659k748961057




          659k748961057












          • Thanks for the reply, but in my case this form is dynamically generated, so doing ajax call is not possible from domain1. You mentioned that the response will appear in the top level frame, now can i get this response back to the domain1 using javascript? I tried with parent.psotMessage but that didn't work.

            – Bhargav Madia
            Mar 11 at 7:12


















          • Thanks for the reply, but in my case this form is dynamically generated, so doing ajax call is not possible from domain1. You mentioned that the response will appear in the top level frame, now can i get this response back to the domain1 using javascript? I tried with parent.psotMessage but that didn't work.

            – Bhargav Madia
            Mar 11 at 7:12

















          Thanks for the reply, but in my case this form is dynamically generated, so doing ajax call is not possible from domain1. You mentioned that the response will appear in the top level frame, now can i get this response back to the domain1 using javascript? I tried with parent.psotMessage but that didn't work.

          – Bhargav Madia
          Mar 11 at 7:12






          Thanks for the reply, but in my case this form is dynamically generated, so doing ajax call is not possible from domain1. You mentioned that the response will appear in the top level frame, now can i get this response back to the domain1 using javascript? I tried with parent.psotMessage but that didn't work.

          – Bhargav Madia
          Mar 11 at 7:12




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55063095%2fsubmit-form-and-stay-on-same-page-with-target-top%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко