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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:04:47+00:00 2026-06-04T11:04:47+00:00

This is my html- simple form with two text inputs: <div id=content> <div id=options>

  • 0

This is my html- simple form with two text inputs:

    <div id="content">
      <div id="options">
        <form id="form1">
          <table>
            <tr>
              <td>Date:</td>
              <td><input name="date" type="text" id="datepicker" /></td>
            </tr>
            <tr>
              <td>Size:</td>
              <td><input name="size" type="text" /></td>
            </tr>
            <tr>
              <td colspan="2"><input name="submit" type="submit" value="Submit"/></td>
            </tr>
          </table>
        </form>
      </div>
      <div id="result"> </div>
    </div>

And I’m trying to get the results of this form on submit to query a MySQL database ‘/details.php’ and then output the results of the PHP file into the DIV ‘result’. I’m struggling on the passing the variables to the PHP file and outputting the results into the DIV. I know I have to use some JQuery AJAX but I’m struggling to get it to work.

This is my current AJAX script:

     <script>
    $('#form1').submit(function(e) {
        e.preventDefault(); // stops form from submitting naturally
        $.ajax({
            data: $(this).serialize(),
            url: '/details.php',
            success: function(response) {
                $('#result').html(response); 
            }
        });
    });
    </script>   

And on my PHP file im trying to aquire the variables with:

     $date=$_GET['date'];
     $size=$_GET['size'];

And then my connection to the database with SQL query and echoing out results. Any suggestions to where I might be going wrong. Thanks for the help!

  • 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-04T11:04:48+00:00Added an answer on June 4, 2026 at 11:04 am

    Edit

    You have to wrap your jQuery code in a domReady event handler, like so:

    $(function() {
        // all your jQuery code goes here!
    });
    

    Here’s a fiddle that works with your existing code: http://jsfiddle.net/89A2m/

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

Sidebar

Related Questions

I got two simple input text fields in a HTML form: <input type=text name=data[User][name]
I have a simple html form with two controls: input-text and input-file I need
I have a simple html form that is structured something like this: <form name=test
I have have a simple HTML form with say four input widgets (see below)...two
I've got this HTML form where I have multiple input elements: text, radio, and
This is probably a basic html/css question... I have a simple one-button form that
I have this simple html: <div class=wrapper> <span class=higher> [higher] <span class=lower> hello </span>
I have this html page which is very simple, it contains a text box
I have simple HTML page with svg like this: <div id=plan> <svg xmlns=http://www.w3.org/2000/svg version=1.1>
Below is simple HTML form , there are two sets of controls on the

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.