title: Ajax Redirect on new page and after display success message
body: <p>I am working with ajax and php. I want to display message on another page after user successfully added using Ajax. I have tried so much. It's working when first display "Success" message on popup and afrer redirect on another page. But i want to first redirect on another page and after display message.</p>
  
  <p><strong>User Add Page:</strong></p>
  
  <pre><code>&lt;form action="&lt;?php echo $action_link; ?&gt;" method="post" id="form_user_profile" class="form-horizontal" novalidate="novalidate"&gt;
  
     &lt;input type="hidden" id="id" name="id" value="&lt;?php echo $id; ?&gt;"&gt;
  
     &lt;div class="form-body"&gt;
       &lt;div class="form-group"&gt;
         &lt;label class="control-label col-md-3"&gt;First Name
           &lt;span class="required" aria-required="true"&gt; * &lt;/span&gt;
         &lt;/label&gt;
         &lt;div class="col-md-4"&gt;
           &lt;div class="input-icon right"&gt;
             &lt;i class="fa"&gt;&lt;/i&gt;
             &lt;input type="text" class="form-control" name="fname" value="&lt;?php echo $user_db[0]['fname']; ?&gt;"&gt; 
           &lt;/div&gt;
         &lt;/div&gt;
       &lt;/div&gt;
       &lt;div class="form-actions"&gt;
         &lt;div class="row"&gt;
           &lt;div class="col-md-offset-3 col-md-9"&gt;
             &lt;input type="submit" class="btn green" name="submit" value="&lt;?php echo $addupdate_msg; ?&gt;"&gt;
           &lt;/div&gt;
         &lt;/div&gt;
       &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Ajax in Validate</strong></p>
  
  <pre><code>$("#form_user_profile").validate({
          rules: {
              fname: {
                  required: true
              }
          },
          messages: {
              fname: "Please enter first name"
          },
          submitHandler: function(form) {
              $.ajax({
                  url: form.action,
                  type: form.method,
                  data: $(form).serialize(),
                  success: function(response) {
                      if(response == 1){
                          bootbox.alert("User has been added successfully.", function() {
                              window.location.href= "&lt;?php echo $user_list; ?&gt;";
                          });
                      }
                  }
              });
          }
  });
  </code></pre>
  
  <p><strong>Action</strong></p>
  
  <pre><code>if (isset($_REQUEST['submit']) &amp;&amp; $_REQUEST['submit'] == "Add") {
  
      $fname = mysqli_real_escape_string($obj-&gt;CONN, $_REQUEST['fname']);    
  
      $user-&gt;setfname($fname);
      $insert = $user-&gt;insert();
  
      ob_get_clean();
  
      if($insert){
          echo '1';
          $_SESSION['msg'] = "New user has been added successfully.";
      }else{
          echo '0';
      }
  
      exit;
  }
  </code></pre>