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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:43:08+00:00 2026-06-04T17:43:08+00:00

New to Jquery, even newer to Jquery Ajax calls – here is my problem:

  • 0

New to Jquery, even newer to Jquery Ajax calls – here is my problem:

I have a small form – email address submit – that fires to a PHP file which inserts the email into a table.

I want to do the following:

  1. Handle the form submission through Ajax so there is no refresh
  2. After successfully writing to the table I want to change the submit button’s text to “Success!” for 3 seconds and then back to
    “Sign Up” with fadeIn and fadeOut effects.

Here is my code for the form:

<form action="" id="registerform" name="registerform" method="post" >
    <input type="text" id="email" name="email" value="Email Address" onClick="empty()" onBlur="determine()" />
    <button id="join" type="submit" name="join" onClick="validate()">Sign Up</button>
</form>

Here is my terrible attempt at handling the POST request through Jquery:

$('form').on('submit', function(e) {
    $.post('register.php', function() {
            $('#join').html('Success!')             
    });        
    //disable default action
    e.preventDefault();
});

Can anyone comment on how to make the Ajax request work (doesn’t seem to be)?

Thanks in advance!

Update

Alright, the following block of Jquery adds the data to the table, however, my button text does not change:

 $('form').on('submit', function(e) {
        $.post('register.php', $("#registerform").serialize(), function() {
            $('#join').html('Success!')             
        });        
    //disable default action
    e.preventDefault();
    });

Any ideas now?

  • 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-04T17:43:09+00:00Added an answer on June 4, 2026 at 5:43 pm

    Here is an example of one of my ajax calls

    details = "sendEmail=true&" + $("form").serialise();
    
    $.ajax({
        url: "yourphppage.php",
        type: "post",
        data: details,
        success: function (data, textStatus, jqXHR) {
            if (data == "false") {
                console.log("There is a problem on the server, please try again later");    
            } else {
                    //Do something with what is returned
            }
        }
    })          
    

    And on the server side

    if (isset($_POST['sendEmail'])) {
      //Do something with the data
    }
    

    Of course this is only an example, and you may need to alter this to suit your needs 🙂

    One thing to note is what if (data == "false") does. Well on the server side i can echo "false" to tell the ajax call it was not successful.

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

Sidebar

Related Questions

A new problem emerged from this thread: jquery form validator never makes ajax call
New to Rails and even newer to Ajax. I have a page that displays
I have application that brings response via Ajax and creates 5-20 new jQuery click
i´m new developing on asp.net mvc, and even newer using jquery, so this is
I am fairly new to jQuery and JavaScript in general. I have a form,
I am new to jQuery. Any help would be appreciated I have two radio
I'm new to jQuery. This would be no problem for me using XPath expressions,
I'm new to jquery and even after looking at examples it eludes me. I
I am new to jQuery. I have PrimeFaces dataTable. when it is converted to
I'm brand new to jquery and am not even sure if I'm referring correctly

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.