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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:57:45+00:00 2026-06-01T02:57:45+00:00

I am trying to get jquery’s .ajax() to send values sent to a form

  • 0

I am trying to get jquery’s .ajax() to send values sent to a form :

                    <form method="post" id="FanDetail">
                        <label for="bio">Brief Bio<br /></label>
                            <textarea id="bio" name="fan_bio" cols="27" rows="3"></textarea><br />
                        <label for="dob">Date of Birth<br/></label>
                            <input id="dob" name="fan_dob" value="(e.g. 01/05/1965)" onFocus="clearText(this)" /><br />     
                        <label for="zip">Location<br /></label>
                            <div class="ui-widget">
                                <input id="zip" name="term" value="What is your Zipcode?" onFocus="clearText(this)" /><br />
                                <input id="actualZip" type="hidden" name="actualzipval" value="" />
                            </div><!--ui-widget :: zip -->
                        <label for="occup">Occupation<br /></label>
                            <div class="ui-widget">
                                <input id="occup" type="text"  name="term2" value="e.g. Computer Programmer, etc" onFocus="clearText(this)" /><br />
                                <input id="actualOccup" type="hidden" name="actualOccupval" value="" />
                            </div><!--ui-widget :: occup -->
                        <label for="fbkurl">Facebook Handle&nbsp;[?]<br /></label>
                            <input id="fbkurl" type="text"  name="fan_fbk" value="e.g. SportsFan12" onFocus="clearText(this)" /><br />
                        <label for="twiturl">Twitter Handle&nbsp;[?]<br /></label>
                            <input id="twiturl" type="text"  name="fan_twit" value="e.g. AboutSports2012" onFocus="clearText(this)" /><br />
                        <label for="phoNum">Phone Number<br /></label>
                            <input id="phoNum" type="text"  name="fan_pho" value="cell or home phone" onFocus="clearText(this)" /><br />
                    <input style="background-image:url('img/save.png');" type="submit" name="saveAbout" value="" id="submit" />
                    </form>
<div class="success" style="display:none;">Got it!</div>

This HTML connects to the JS file submitvalues.js

//////////////// About Tab
$(document).ready(function(){
    $("form#FanDetail").submit(function() {
    // store the values from the form input box, then send via ajax below
    var bio = $('#bio').val();
    var dob = $('#dob').val();
    var zip = $('#actualZip').val();
    var occup = $('#actualOccup').val();
    var fbkurl = $('#fbkurl').val();
    var twiturl = $('#twiturl').val();
    var phoNum = $('#phoNum').val();
    $.post(
            "../src/php/registration/about/submitvalues_about_tab.php",
            $("form#FanDetail").serialize(),
            function(){
                $('form#FanDetail').hide(function(){
                    $('div.success').fadeIn();
            });
          });
       return false;
    });
});

This JS file, then connects to a php script that sends them to mysql via PDO
UPDATED PHP:

///////////////////////////////////////////////
######## Get  Input to Submit ############## //
///////////////////////////////////////////////
$fanBio = $_POST['bio'];             //////
$fanDob = $_POST['dob'];             //////
$zipval = $_POST['zip'];             //////
$occupval = $_POST['occup'];         //////
$facebookurl = $_POST['fbkurl'];         //////
$twitterurl = $_POST['twiturl'];         //////
$phoneNum = $_POST['phoNum'];        //////
$fanID = 1;
///////////////////////////////////////////////

try{
    ## Get current user and their session ID:
    $sessionvar = session_id();
    ### DB Connection already established above.
    $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );  
    // INSERT CLEAN DATA INTO TABLE…
    $sth = $dbh->prepare("
    UPDATE Fan 
    SET fanBio=?,fanDob=?,fanDetLocID=?,occupID=?,fanFbk=?,fanTwit=?,fanPho=?
    WHERE fanID = ?
    ");
    $sth->bindValue(1,$fanBio);
    $sth->bindValue(2,$fanDob);
    $sth->bindValue(3,$zipval);
    $sth->bindValue(4,$occupval);
    $sth->bindValue(5,$facebookurl);
    $sth->bindValue(6,$twitterurl);
    $sth->bindValue(7,$phoneNum);
    $sth->bindValue(8,$fanID);
    $sth->execute();
    $count = $stmt->rowCount(); // check row count
    $sth->debugDumpParams(); ## debugging query
} 

Error I’m getting: None. It says after I fill in all the inputs Got it! and thus it had fired off the .success class.

I tried:

  • Manually entering in this information via mysql – works fine.
  • Running Javascript Console to debug, it is sending it fine on the JS end, since I get this, once I click the send button:
    img

When I fill in the input and look at the JS Console under Network->Response I get on the PHP FILE:

   SQL: [107] 
    UPDATE Fan 
    SET fanBio=?,fanDob=?,fanDetLocID=?,occupID=?,fanFbk=?,fanTwit=?,fanPho=?
    WHERE fanID = 1

Params:  7
Key: Position #0:
paramno=0
name=[0] ""
is_param=1
param_type=2
Key: Position #1:
paramno=1
name=[0] ""
is_param=1
param_type=2
Key: Position #2:
paramno=2
name=[0] ""
is_param=1
param_type=2
Key: Position #3:
paramno=3
name=[0] ""
is_param=1
param_type=2
Key: Position #4:
paramno=4
name=[0] ""
is_param=1
param_type=2
Key: Position #5:
paramno=5
name=[0] ""
is_param=1
param_type=2
Key: Position #6:
paramno=6
name=[0] ""
is_param=1
param_type=2

Should $sth->execute(); have all the bound params in it as an array??

  • 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-01T02:57:46+00:00Added an answer on June 1, 2026 at 2:57 am

    try the following i hope it will post here is a more detailed tutorial oh how it works

    http://api.jquery.com/jQuery.ajax/

     $(document).ready(function(){
            $("form#FanDetail").submit(function() {
            // store the values from the form input box, then send via ajax below
            var bio = ;
            var dob = $('#dob').val();
            var zip = $('#actualZip').val();
            var occup = $('#actualOccup').val();
            var fbkurl = $('#fbkurl').val();
            var twiturl = $('#twiturl').val();
            var phoNum = $('#phoNum').val();
                      $.ajax({
                      type: "POST",
                      url: "../src/php/registration/about/submitvalues_about_tab.php"
                      data: "bio=" + bio + "&dob=" + dob +"&zip=" + zip + "&occup=" + occup      +"&fbkurl=" + fbkurl + "&twiturl=" + twiturl +"& phoNum=" +  phoNum,
                      }).done(function( msg ) {
                         $('div.success').fadeIn();
                     });
               return false;
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get JQuery to post JSON to a server: $.ajax({ url: /path/to/url, type:
I'm trying to get the jQuery slider to have set values to slide to
I'm trying to get an jquery ajax callback function to update the background colour
I'm trying to get jQuery validate to work with my radio button form. However,
I am trying to get jQuery to send a mousedown event to the Drupal
I am trying to get jquery validate to work on multiple fields. Reason being
I am trying to get jquery to pick up variable that I am defining
I am trying to get simple jQuery to execute on my Content page with
I'm trying to get the jQuery Mobile events( https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.event.js ) to work as a
I'm in the process of trying to get the jQuery plugin, Uploadify , to

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.