text: //Ajax Call for the sign up form 
  //Once the form is submitted
  $("#signupform").submit(function(event){ 
      //prevent default php processing
      event.preventDefault();
      //collect user inputs
      var datatopost = $(this).serializeArray();
  //    console.log(datatopost);
      //send them to signup.php using AJAX
      $.ajax({                 //这里的ajax()方法也可以用post(),但是有一些用法上的不同
          url: "signup.php",
          type: "POST",
          data: datatopost,
          success: function(data){
              if(data){
                  $("#signupmessage").html(data);
              }
          },
          error: function(){
              $("#signupmessage").html("<div class='alert alert-warning'>There was an error with the Ajax Call. </div>");
          }
      });
  });
  
  
  //Ajax Call for the login form
  //Once the form is submitted
  $("#loginform").submit(function(event){ 
      //prevent default php processing
      event.preventDefault();
      //collect user inputs
      var datatopost = $(this).serializeArray();
  //    console.log(datatopost);
      //send them to login.php using AJAX
      $.ajax({
          url: "login.php",
          type: "POST",
          data: datatopost,
          success: function(data){
              if(data == "success"){
                  window.location = "mainpageloggedin.php";
              }else{
                  $('#loginmessage').html(data);   
              }
          },
          error: function(){
              $("#loginmessage").html("<div class='alert alert-warning'>There was an error with the Ajax Call. </div>");   
          }    
      });
  
  });
  
  
  //Ajax Call for the forgot password form
  //Once the form is submitted
  $("#forgotpasswordform").submit(function(event){ 
      //prevent default php processing
      event.preventDefault();
      //collect user inputs
      var datatopost = $(this).serializeArray();
  //    console.log(datatopost);
      //send them to signup.php using AJAX
      $.ajax({
          url: "forgot-password.php",
          type: "POST",
          data: datatopost,
          success: function(data){
              $('#forgotpasswordmessage').html(data);
          },
          error: function(){
              $("#forgotpasswordmessage").html("<div class='alert alert-warning'>There was an error with the Ajax Call.</div>");          
          }   
      });
  
  });