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 7708163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:32:27+00:00 2026-06-01T00:32:27+00:00

I want to post some values from a simple HTML form, validate them with

  • 0

I want to post some values from a simple HTML form, validate them with an ajax call and if successful submit to a PHP script and redirect to that script. I have got the ajax part set up, just not sure how to post and redirect (as if you would on a standard form submit without ajax).

Here’s what I have:

HTML:

<div id=audiencesearch>

    <h1>Audience Search</h1>

<form id="audiencesearchform">

<p>Passion Point</p>
<select id="passionselect">
<option selected="selected">Please select</option>
    <option>3D</option>
    <option>Music</option>
<option>Playstation</option>
    </select>

<p>Gender Bias</p>
<select id="genderselect">
<option selected="selected">Please select</option>
    <option>Male</option>
    <option>Female</option>
    </select>

<p>Sort Group By Age Range</p>
<select id="ageselect">
<option selected="selected">Please select</option>
<option>Under 21</option>
    <option>21 - 30</option>
    <option>31 - 40</option>
<option>41 - 50</option>
    </select>

<br/>
<br/>

<input onClick="ajaxaudiencesearch()" class="submitaudiencesearch" value="Search" type="button"/>

Ajax Call:

 <script type="text/javascript">

function ajaxaudiencesearch(){

    var passionpoint = $("select#passionselect").val();  
    var genderbias = $("select#genderselect").val();  
    var agerange = $("select#ageselect").val();
    var passedstring = 'passion='+ passionpoint + '&gender=' + genderbias + '&age=' + agerange;

    $.ajax({
        type: "POST",
        url: "processaudiencesearch.php",
        data: passedstring,
        success:function(retval){       
            if (retval == 'oktoprocess'){

                audiencesearchprocess();

            } else {
                audiencesearcherror();
            }

        }
    })
}

function audiencesearcherror(){

    $('#audienceerror').html('GOTTA SELECT EM ALL');

}

function audiencesearchprocess(){

    window.location.href = "searchresults.php";

//THIS IS WHERE I WANT TO POST AND MOVE TO SEARCHRESULTS.PHP

}

</script>

PHP to handle Ajax:

    <?php

include('sonymysqlconnect.php'); 
session_start();

$nullselection = "Please select";

//get the posted values
$postedpassion = ($_POST['passion']);
$postedgender = ($_POST['gender']);
$postedage = ($_POST['age']);


if (($postedpassion != $nullselection ) && ($postedgender != $nullselection ) && ($postedage != $nullselection)){
    echo 'oktoprocess';
} else {
    echo 'error';
}

?>

Preferably I could achieve this using jQuery. I’m sure it’s extremely simple but I’m not sure how to do it?!

It’s worth mentioning that this is all set up correctly. I have used PHP includes.

Thanks in advance…

  • 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-01T00:32:28+00:00Added an answer on June 1, 2026 at 12:32 am

    Why not add action and method attributes to your form and then submit it with .submit()?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple form with some PHP code to post to a database
I want to send some strings in a list in a POST call. eg:
I want to make a POST to a PHP site from a C# WinForm
I have a very simple scenario where I want to POST the form using
I want to post some data via javascript to another domain. Something like: http://www.othersite.com/submitfunnyname?name=blah
I want to filter some reserved word on my title form. $adtitle = sanitize($_POST['title']);
I want to POST an URL using CURL and php. There is a big
I want to make a form like this, and i want to post the
I have made a simple form with one textField and command, I want to
How do I create some simple ajax rating like there is on this page

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.