Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5933829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:01:43+00:00 2026-05-22T15:01:43+00:00

When I click Submit Second, the page goes to first.html. I want it to

  • 0

When I click “Submit Second,” the page goes to first.html. I want it to go to second.html

index.html

<body onload="secondForm();">
<script type="text/javascript">
function ajaxRequest(){
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] // activeX versions in IE
if (window.ActiveXObject){ // test support for ActiveXObject in IE
    for (var i=0; i<activexmodes.length; i++){
        try{
            return new ActiveXObject(activexmodes[i])
        }
        catch(e){
            // suppress
        }
    }
}
else if (window.XMLHttpRequest) // mozilla,safari,chrome,opera
    return new XMLHttpRequest()
else
    return false
}
function secondForm(id) {
var mygetrequest=new ajaxRequest()
mygetrequest.onreadystatechange=function() {
    if (mygetrequest.readyState==4) {
        if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1) {
            document.getElementById("secondForm").innerHTML=mygetrequest.responseText
        }
    }
}
mygetrequest.open("POST", "secondForm.html, true)
mygetrequest.send(null)
}
</script>

<form method="POST" action="first.html" id="firstForm">
<span id="secondForm"></span>
<input type="submit" value="Submit First">
</form>

secondForm.html

<form method="POST" action="second.html" id="secondForm">
<input type="submit" value="Submit Second">
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:01:44+00:00Added an answer on May 22, 2026 at 3:01 pm

    You have a form within a form, the outer form gets processed on submit.

    Also I would suggest using a library for your ajax requests, i use jQuery:

    $('#secondForm').load('secondForm.html');
    

    Change you HTML so this would work:

    <form method="POST" action="first.html" id="firstForm">
       <input type="submit" value="Submit First">
    </form>
    
    <span id="secondForm"></span>
    

    secondForm.html

    <form method="POST" action="second.html" id="secondFormID"> <-- use a different ID
       <input type="submit" value="Submit Second">
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which I want to submit upon button click which is
I have an HTML page with a simple form. When the user clicks submit,
Here is a snippet of my html: <input id=btnGetDate type=submit value=Get Date /> <div
html in delete_define.php follows: <form action=delete_now.php onsubmit=my_funct();> <input type=submit name=my_submit class=my_submit value=submit/> </form> javascript
... $(document).ready(function(){ $('form').submit(function(){ $('input#second').focus(); return false; }); $('#first').blur(function(){ alert('blur'); }); }); ... <form> <input
I have a website where I have to click a submit button on a
I click on items in my listbox and then hit a submit button, but
The following code does not submit the input values: $('.button').live('click', function() { var date
What I am trying to do is: When you click on a form submit
When a user clicks a submit button I want the form to be submitted.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.