Advertisement
Guest User

contact.html

a guest
Jul 22nd, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.    
  3.     $("#ajax-contact-form").submit(function() {
  4.         $('#load').append('<center><img src="ajax-loader.gif" alt="Currently Loading" id="loading" /></center>');
  5.  
  6.         var fem = $(this).serialize(),
  7.             note = $('#note');
  8.    
  9.         $.ajax({
  10.             type: "POST",
  11.             url: "/contact/contact.php",
  12.             data: fem,
  13.             success: function(msg) {
  14.                 if ( note.height() ) {         
  15.                     note.slideUp(500, function() { $(this).hide(); });
  16.                 }
  17.                 else note.hide();
  18.  
  19.                 $('#loading').fadeOut(300, function() {
  20.                     $(this).remove();
  21.  
  22.                     // Message Sent? Show the 'Thank You' message and hide the form
  23.                     result = (msg === 'OK') ? '<div class="success">Your message has been sent. Thank you!</div>' : msg;
  24.  
  25.                     var i = setInterval(function() {
  26.                         if ( !note.is(':visible') ) {
  27.                             note.html(result).slideDown(500);
  28.                             clearInterval(i);
  29.                         }
  30.                     }, 40);    
  31.                 }); // end loading image fadeOut
  32.             }
  33.         });
  34.  
  35.         return false;
  36.     });
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement