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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:21:34+00:00 2026-06-10T21:21:34+00:00

I have a registration form which validates the users email with JS and PHP

  • 0

I have a registration form which validates the users email with JS and PHP and then checks the DB to see if the email exists. Everything happens on a single page with JSON.

I need the successful outcome to RETURN TRUE and take me to the next page in the registration sequence. I tried window.location under case: success and it takes me to the correct page however it doesn’t carry over the hidden fields in my form.

Can someone give me an idea on how this should be executed?

$(document).ready(function(){
$('#newsletter-signup').submit(function(){

    //check the form is not currently submitting
    if($(this).data('formstatus') !== 'submitting'){

        //setup variables
        var form = $(this),
            formData = form.serialize(),
            formUrl = form.attr('action'),
            formMethod = form.attr('method'), 
            responseMsg = $('#signup-response');

        //add status data to form
        form.data('formstatus','submitting');

        //show response message - waiting
        responseMsg.hide()
                   .addClass('response-waiting')
                   .text('Please Wait...')
                   .fadeIn(200);

        //send data to server for validation
        $.ajax({
            url: formUrl,
            type: formMethod,
            data: formData,
            success:function(data){

                //setup variables
                var responseData = jQuery.parseJSON(data), 
                    klass = '';

                //response conditional
                switch(responseData.status){
                    case 'error':
                        klass = 'response-error';
                    break;
                    case 'success':
                        klass = 'response-success';
                        //return true; I tried this but it fails.
                    break;  
                }

                //show reponse message
                responseMsg.fadeOut(200,function(){
                    $(this).removeClass('response-waiting')
                           .addClass(klass)
                           .text(responseData.message)
                           .fadeIn(200,function(){
                               //set timeout to hide response message
                               setTimeout(function(){
                                   responseMsg.fadeOut(200,function(){
                                       $(this).removeClass(klass);
                                       form.data('formstatus','idle');
                                   });
                               },3000)
                            });
                });
            }
        });
    }

    //prevent form from submitting
    return false;
});
});
  • 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-10T21:21:35+00:00Added an answer on June 10, 2026 at 9:21 pm

    Can you not just remove the submit handler on success and let the form submit for “real”?

    Replace

    //return true; I tried this but it fails.
    

    With

    $('#newsletter-signup').unbind('submit').submit();
    

    Sidenote: returning whatever from a success callback does not make the form “do” anything else. The return false; statement have already been executed when the ajax function is complete. You need to resubmit the form again, this time without ajax.

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

Sidebar

Related Questions

I have a registration form which displays a users Name (textbox), Email (textbox) and
I have this registration form which is then validated using "bassistance's" validate.js: $('#pForm').validate({ rules:
I currently have a registration form which checks a persons date of birth via
I have designed a registration form which you can see here . It includes
i have a registration form which contains a postalcode and a country drop down
in my project i have one registration form which is developed in C#.net.to this
I am building a PHP registration form which takes the following fields for up
I have registration form, which is saving user info in 'tblusers' -> 'Username', but
The website has a normal registration form which allows users to register and the
I have several text fields which compromise a registration form . When the user

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.