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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:51:45+00:00 2026-05-27T10:51:45+00:00

I am currently trying to create a multi-page form that uses both jQuery and

  • 0

I am currently trying to create a multi-page form that uses both jQuery and PHP together to error check. The issue I have is that I am relatively new to jQuery, and don’t know how to move to the second form rather than just display a success message from a PHP array.

I have used the example from ( http://www.youtube.com/watch?v=BwExOhVaUyk ) as my guide. Its an example that uses the ajax_submit to process when form is ready, if it is successful the PHP script runs and error checks and then throws back a successful message.

I do not want the success message. I want if successful to move to second page, but not sure how to do this.

The following is the ajax code

// make our ajax request to the server
function submitForm(formData) {
    $.ajax({    
        type: 'POST',
        url: 'feedback.php?images=' + encs.toString(),      
        data: formData,
        dataType: 'json',
        cache: false,
        timeout: 7000,
        success: function(data) {           

            if(data.error == true){

            $('form #response').removeClass().addClass('error').html(data.msg).fadeIn('fast');                                      

            } else{
                $("#rightcolumn").fadeOut(500, function(){

                    //NOTE THIS IS THE LINE THAT BRINGS BACK THE SUCCESSFUL MESSAGE STORED IN data.msg (taken from array in php file).

                    $("#rightcolumn").append().html(data.msg).fadeIn(500);
                });

            }



        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {

            $('form #response').removeClass().addClass('error')
                        .html('<p>There was an<strong> ' + errorThrown +
                              '</strong> error due to a<strong> ' + textStatus +
                              '</strong> condition.</p>').fadeIn('fast');           
        }

THE PHP

$return['error'] = false;
            $return['msg'] = "<html>";
            $return['msg'] .="<head>"; 
            $return['msg'] .="</head>"; 
            $return['msg'] .= "<div id=\"coverrightb\">";
            $return['msg'] .= "<body>";
            $return['msg'] .= "<h2>Successful Registration <img id=\"thumbsup\" src=\"images/icons/thumbsup.png\" alt=\"ThumbsUp\" /></h2>";
            $return['msg'] .= "<br />"; 
            $return['msg'] .= "<p>Thanks for registering " .$firstname .". Your details are below.</p>";
            $return['msg'] .= "<br />"; 
echo json_encode($return);

I want it to simply move on to second page, not sure how to do this. Would be really grateful for some guidance. I’m learning PHP and jQuery but been stuck on this for several weeks.

Many thanks

  • 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-27T10:51:45+00:00Added an answer on May 27, 2026 at 10:51 am

    You can redirect users by changing window.location to the desired URL:

        success: function(data) {           
            if(data.error == true){
                $('#response').removeClass().addClass('error').html(data.msg).fadeIn('fast');
            } else{
                $("#rightcolumn").fadeOut(500, function(){
    
                    //NOTE THIS IS THE LINE THAT BRINGS BACK THE SUCCESSFUL MESSAGE STORED IN data.msg (taken from array in php file).
                    window.location = 'form-page-2.php';//note that this line will stop running the JavaScript on this page, so the next line will not run
    
                    $("#rightcolumn").append().html(data.msg).fadeIn(500);
                });
    
            }
        },
    

    Another solution would be to load the new form into the same page via AJAX so the user doesn’t have to load a whole new page:

        success: function(data) {           
            if(data.error == true){
                $('#response').removeClass().addClass('error').html(data.msg).fadeIn('fast');
            } else{
                $("#rightcolumn").fadeOut(500, function(){
    
                    //NOTE THIS IS THE LINE THAT BRINGS BACK THE SUCCESSFUL MESSAGE STORED IN data.msg (taken from array in php file).
    
                    $("#rightcolumn").load('form-page-2.php #only-the-form', function () {
                        $(this).fadeIn(500);
                    });
                });
    
            }
        },
    

    Some documentation for ya:

    • window.location: https://developer.mozilla.org/en/DOM/window.location
    • .load(): http://api.jquery.com/load
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi page form that I am trying to implement on my
I'm currently trying to create a kernel module that will produce data based on
I'm currently trying to create a program that estimates location based on signal strength.
I am currently trying to create an Android application that loops Audio from the
I'm currently trying to create a page for users to select two points from
I'm currently trying create a service that will return results of a OLAP cube
I'm currently trying to create buttons which are in the form of loosely stacked
I'm currently trying to create the app.config at runtime. The basic idea is that
I am trying to build a multi-page form with Yii, but am quite new
I am currently trying to create a win32 service using pywin32. My main point

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.