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

  • SEARCH
  • Home
  • 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 8543063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:12:53+00:00 2026-06-11T12:12:53+00:00

My goal is to submit an entire form through an ajax function which will

  • 0

My goal is to submit an entire form through an ajax function which will then send those values to a php file. I’m using Post for several reasons – one being that I will be changing data within a MySQL database.

I’ve seen a few examples while I was searching for an answer, but none of them seem to have addressed the issue I’m having directly.

For instance, this example:

var url = "get_data.php";
var params = "lorem=ipsum&name=binny";
http.open("POST", url, true);

// Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

// Call a function when the state changes.
http.onreadystatechange = function() {
    if(http.readyState == 4 && http.status == 200) {
        alert(http.responseText);
    }
}
http.send(params);

starts to address it.

To be specific, I am not sure how to go about sending multiple values. In the example I found above, I see that they hard coded two values into their statement in the variable params. I’m wanting to know how to pass those values to the function without having to hard code them.

My form:

<table border="0" cellpadding="2" cellspacing="5">
    <th colspan="2" align="center">Check Out</th>
    <form name="checkOut" method="post" onSubmit="return(validate(this))"> 
        <tr>
            <td>Territory Number</td>
            <td><input type="text" name="numberOut" tabindex="1" maxlength="3" size="3" /></td>
        </tr>
        <tr>
            <td>First Name of Publisher</td>
            <td><input type="text" onKeyUp="showHint(this.value)" name="fName" tabindex="2" maxlength="15"/></td>
        </tr>
        <tr>
            <td>Last Name of Publisher</td>
            <td><input type="text" onKeyUp="showHint_l(this.value)" name="lName" tabindex="3" maxlength="15" /></td>
        </tr>
        <tr>
            <td>Special Campaign</td>
            <td><input type ="checkbox" name="specialC" tabindex="4" value="Yes"/></td>
        </tr>
        <tr>
            <td><input type="button" onClick="clearForm()" value="Reset" /></td>
            <td><input type="submit" value="Check Out" /></td>
        </tr>
    </form>
    <p>Suggestions: <span id="txtHint"></span></p>
</table>

Here, I want to pass the values of numberOut, fName, lName, and specialC. I know how to pass each of them individually, but not as a group. Ultimately, I want to then be able to access those value through php with $_POST[‘fName’] for instance.

From seeing several answers to similar questions on this site, a number of people say to use jQuery. I’m aware that it is easier, but I want to learn to use ajax first as I’m new to web-based languages.

  • 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-06-11T12:12:54+00:00Added an answer on June 11, 2026 at 12:12 pm

    You will have to create the params

    Here is a sample code for you

    var params = "numberOut="+document.getElementsByName("numberOut")[0].value;
    params+="?fName="+document.getElementsByName("fName")[0].value;
    params+="?lName="+document.getElementsByName("lName")[0].value;
    var isSc = document.getelementsByName("specialC")[0].checked;
    if(isSc){
        params+="?specialC=Yes";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to submit a form in a Colorbox modal via ajax (that
Good evening guys, I'm trying to pass multiple checkbox values through AJAX and process
My original goal was to get a php file to execute on a button
When I am clicking a submit button on my HTML form, the function related
Problem analysis: When I'm clicking a submit button of my html form the function
Why in this scenario is id null when it reaches the Action? Javascript $(#ajax-submit).click(function
goal : I want to place a text after the submit button using hook_form_alter.
Goal: to create a percentage column based off the values of calculated columns. Here's
My goal is for the user to fill out one form and use JavaScript
Goal : I have a view which displays multiple nodes in full view including

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.