JQuery add/remove class?

JQuery add/remove class?

So I have been creating a simple coming soon page for a site. One of the things I want to be possible id that the form button changes class (colour and background image essentially). These scripts that it uses being process.php do work and I have validated that with the end collection of the emails once they have been put correctly into the form. I can say that all of the JQuery works up until the point where the user errors the form first and then gets a successful entering of the email. Heres my code and also a live version of the site. Any help would be greatly appreciated.

  1. $(document).ready(function() {
  2.             $('#formContainer').submit(function() {
  3.                 var formData = $(this).serialize();
  4.                                  $.post('process.php', formData, processData);
  5.                 function processData(data) {
  6.                     if (data=='1') {
  7.                         if ($('.button').hasClass('buttonFail')) {
  8.                                 $('.button').removeClass('buttonFail').addClass('buttonSuccess').hide().fadeIn();
  9.                         }
  10.                             $('.form').append('<p class="alert">your email is in, we will let you know when we go live!</p>');
  11.                             $('.button').removeClass('button').addClass('buttonSuccess').hide().fadeIn();
  12.                             
  13.                     } else if (data=='2') {
  14.                             $('.button').removeClass('button').addClass('buttonFail').hide().fadeIn();
  15.                     } else if (data=='3') {
  16.                             $('.button').removeClass('button').addClass('buttonFail').hide().fadeIn();
  17.                     }

  18.                 }
  19.                 return false;
  20.             });
  21.         });