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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:06:25+00:00 2026-05-28T02:06:25+00:00

So I have a really simple form on a website that’s entirely AJAX based

  • 0

So I have a really simple form on a website that’s entirely AJAX based for loading its pages. The only way for this form to work would be for it to do some AJAX magic as well, so I set about doing it. I had the form tested so I knew it all worked.

Here’s the javascript for my form.
The variable “fullpath” just tells me what page is loaded at the moment, all of the pages are stored in the local “pages” directory.
It serializes the form and sends it to the server, with some debugging alerts.

$(document).ready(function() {
$("#regForm").submit(function(event) {
    alert($(this).serialize());
        $.post("pages/" + fullpath, $(this).serialize(), function(data){
            alert(data);                      
        });
        return false;
  });
});

Here’s the form itself

<form name="input" id="regForm">
<div class="form-field"><label>Username</label> <input type="text" name="username"/></div>
<div class="form-field"><label>Password</label> <input type="password" name="password"/></div>
<div class="form-field"><label>Confirm Password</label> <input type="password"  name="password2"/></div>
<div class="form-field"><label>Screen Name</label> <input type="text" name="screenname"/></div>
<div class="form-field"><label>Email Address</label> <input type="text" name="address"/></div>
<div class="form-field"><label>Group</label> <select name="usergroup"> 
<option value="0">Superuser</option>
<option value="1">Admin</option>
<option value="2">Moderator</option>
<option value="3">Advmember</option>
<option value="4">Member</option>
<option value="5">Guest</option>
</select> <br />
<label>Submit: </label><input type="submit" value="Submit" />
</div>
</form>

And here’s some PHP I put at the beginning of the page

print_r($_POST);

So I fill the form with some bogus info, and I press submit. All of the data is displayed with the

alert($(this).serialize());

And then the call is successful and I see the loaded form with my

alert(data);

But, where I ask to print the $_POST array in PHP, this is all I get

Array ()

So jQuery is sending the data, it’s getting the page back, but for some reason the POST variables aren’t going through. Anyone care to lend a hand?

  • 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-05-28T02:06:26+00:00Added an answer on May 28, 2026 at 2:06 am

    This works in a Fiddle.

    Are you sure that fullpath is defined globally ? I don’t see any other possible source of errors in your code.

    Edit: I can see the actual problem from your comments: 301 redirects don’t work through POST:

    If the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

    You need remove this redirect thing, so "pages/" + fullpath directly points to the PHP script. This could also be a problem with your server configuration.

    In case of Apache, you might also want to have a look at this SO question.

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

Sidebar

Related Questions

I have a simple contact form on a website that has 2 text fields,
I have a really simple search form with the following Label (Search) Textbox (fixed
I have a really simple ASP.NET web application and a web setup project that
I have a really simple Java class that effectively decorates a Map with input
I have a really simple class with two methods; One that will be called
I have a really simple XML file that I'm trying to read, but I
I have a VERY simple windows form that the user uses to manage Stores.
I have a simple reg form (Name, Email, Password) on my website and im
this is probably really simple for a jQuery expert. I have <div id="form23"><form><textarea>blahblah</textarea><input type="button"
i have a simple form on my page with a textbox and button that

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.