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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:46:11+00:00 2026-06-17T19:46:11+00:00

jQuery doesn’t seem to be passing form variables or the http POST action when

  • 0

jQuery doesn’t seem to be passing form variables or the http POST action when using the .ajax()

Doing a var_dump( $_POST ); results in an empty array.

Suggestions? What have I done wrong…. it’s a simple concept –
Someone esle posted a similar Q, but no one responded, his solution was adding an id to the form, mine already has that, so it’s not fixing my issue.

currently I’m viewing the return page contents in firebug – I’m not doing anything yet, because I can’t get the data to the server…(first things first).

My HTML

<script type="text/javascript">
$( document ).ready( function(){
    $( "#myform" ).submit( function () {
        $.ajax({
            type: "POST",
            dataType: "html",
            cache: false,
            url: "x.php",
            success: function( data ){              
                //...tell user there was success...
            },
            error: function( data ){
                //...tell user thre was a problem...
            }
        });
        return false;
    });     
});
</script>

<form name="myform" id="myform" action="" method="POST">
    <label for="name" id="name_label">x: </label>
    <input type="text" name="x" id="x" size="30" value=""/> 
    <input type="submit" name="submit" value="Submit"> 
</form>
<div id="results"><div>

And here is the (x.php) PHP code – very simple proof of concept…

<?php
var_dump( $_GET );
var_dump( $_POST );
var_dump( $_REQUEST );
?>

the response looks like this

array(0) {}
array(0) {}
array(1) {
  ["PHPSESSID"]=>
  string(26) "e1j18j..."
}
  • 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-17T19:46:13+00:00Added an answer on June 17, 2026 at 7:46 pm

    You didn’t pass any post data in the ajax call, try

        $.ajax({
            type: "POST",
            dataType: "html",
            cache: false,
            url: "x.php",
            data: $(this).serialize(),
            success: function( data ){              
                //...tell user there was success...
            },
            error: function( data ){
                //...tell user thre was a problem...
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried putting this line but it doesn't work: // @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js jQuery doesn't
My Jquery code doesn't seem to work in IE8 when adding a doctype above
I have a strange error where my jquery ajax request doesn't submit all the
jQuery's getScript function doesn't seem to support an error callback function. I can't use
The jQuery ajax script below doesn't work on my site if url is without
it doesn't seem that jquery ui themes does anything to multiselect listboxes. does anyone
As I've said: Jquery doesn't work .this selection, what am I doing wrong? altho
It seems to me that jQuery doesn't seem to be written as an OOP
Posting non-latin based languages with ajax + jquery doesn't save to mysql the correct
When using an importjs() type of function (see below for an example), jQuery doesn't

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.