title: Jquery Notification on Ajax POST Success
body: <p>I have an issue with a some of the jQuery notifications I have created to trigger based on information echo'd from a PHP file after a user submits a sign up HTML form via AJAX. The notifications for errors work, but not for a successful post to the database. I know that the success notification should show because the data is validated and written to the database and AJAX post is successful. However the success notification does not want to work. What could be the reason for this technicality?</p>
  
  <p>I have the following set up:</p>
  
  <p><strong>signup.html</strong> (contains the following ajax within the page*):</p>
  
  <pre><code>function registerUser(formKey) {
  $.ajax({
      type:"POST",
      url:"engine/new_user.php",
      data: $("#"+formKey).serialize(),
      cache:false,
      success: function(data) {
  
          if(data == -3){
              $("html, body").animate({ scrollTop: 0 }, 600);
              $("#user-exists-notification").fadeIn(1000);
              }
          if(data == -4){
              $("#account-created").fadeIn(1000);
              }
          if(data == -1){
              $("html, body").animate({ scrollTop: 0 }, 600);
              $("#fields-complete-notification").delay(1000).fadeIn(1000);
              }
          if(data == -2){
              $("html, body").animate({ scrollTop: 0 }, 600);
              $("#pw-confirm-notification").delay(1000).fadeIn(1000);
              }
      },
      error: function(data) {
  
      }
  });
  }
  </code></pre>
  
  <p><strong>new_user.php</strong></p>
  
  <pre><code> require("register-classes.php");
  
   $register=new Register($_POST['fname'], $_POST['lname'], $_POST['email'], $_POST['sex'], $_POST['birthdate'], $_POST['phone'], $_POST['country'], $_POST['alias'], $_POST['handle'], $_POST["password"], $_POST["cpassword"], $_POST['network']);
  
  if($register-&gt;checkFields()== false){
  
       echo -1;
  
   } else if($register-&gt;confirmPasswords()== false){
  
       echo -2;
   }else if($register-&gt;registerUser()!=false){
  
  
       echo -4;
   } else if($register-&gt;registerUser()==false){
       echo -3;
   }
  
  
  and register-classes.php (which contains classes for processing sign up form)
  
      class Register {
  
          public function __construct($fname, $lname, $mail, $sex,
          $birthday, $phonenumber, $regCountry, $alias, $username,
          $password, $conf_password, $network_site) {
  
              //Copy Constructor
              $this-&gt;site=$network_site;
              $this-&gt;firstname=$fname;
              $this-&gt;lastname=$lname;
              $this-&gt;email=$mail;
              $this-&gt;sex=$sex;
              $this-&gt;birthdate=$birthday;
              $this-&gt;phone=$phonenumber;
              $this-&gt;country=$regCountry;
              $this-&gt;displayname=$alias;
              $this-&gt;handle=$username;
              $this-&gt;salt="a2cflux9e8g7ds6ggty589498j8jko007876j89j8j7";
              $this-&gt;password=crypt($this-&gt;salt.$password);
              $this-&gt;joindate=date("Y-m-d H:i:s");
              $this-&gt;confirm_password1=$password;
              $this-&gt;confirm_password2=$conf_password;
  
          }
  
          public function registerUser(){
  
              $database=new Database();
              $database-&gt;getConnection();
              $database-&gt;startConnection();
  
              //Check database to insure user and email address is not already in the system.                     
              $checkUsers= mysql_query("SELECT network_users.network_id
              FROM network_users, network_profile
              WHERE network_users.handle = '$this-&gt;handle'
              OR network_profile.email = '$this-&gt;email'");
  
              $numRecords= mysql_num_rows($checkUsers);
  
              if($numRecords == 0){
  
                  $addUser= mysql_query("INSERT INTO network_users(handle, password, date_created, parent_network, site_created, active, account_type, del)
                  values('$this-&gt;handle', '$this-&gt;password', '$this-&gt;joindate',' fenetwork', 'network', 'active', 'standard', 'F')") or die(mysql_error());
  
                  $networkId=mysql_insert_id();
  
                  $addProfile= mysql_query("INSERT INTO network_profile(network_id, first_name, last_name, email, sex, birthdate, phone, country, display_name, del)
                  values('$networkId', '$this-&gt;firstname', '$this-&gt;lastname', '$this-&gt;email','$this-&gt;sex', '$this-&gt;birthdate', '$this-&gt;phone', '$this-&gt;country', '$this-&gt;displayname', 'F')") or die(mysql_error());
  
                  $this-&gt;addUser;
                  $this-&gt;addProfile;
  
                              return true;
  
              }
              else{
  
                  return false;
              }
          }
  
          public function checkFields(){
              if(($this-&gt;firstname)!="" &amp;&amp; ($this-&gt;lastname)!="" &amp;&amp; ($this-&gt;email)!="" &amp;&amp; ($this-&gt;sex)!="" &amp;&amp; 
                  ($this-&gt;birthdate)!="" &amp;&amp;($this-&gt;country)!="" &amp;&amp; ($this-&gt;handle)!="" &amp;&amp; ($this-&gt;password)!=""){
  
                  return true;     
              } else {
  
                  return false;
              }
  
          }
  
          public function confirmPasswords(){
  
              if($this-&gt;confirm_password1==$this-&gt;confirm_password2){
  
                  return true;
              } else {
  
                  return false;
              }
          }
  
          private $site, $firstname, $lastname, $email,
          $sex, $birthdate, $phone, $country, $displayname, 
          $handle, $password, $salt, $joindate, $confirm_password1, $confirm_password2;
  
          protected $addUser, $addProfile;
  
      }
  </code></pre>