Advertisement
Guest User

Untitled

a guest
Aug 18th, 2013
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(document).ready(function(){
  2.  
  3.  
  4.     $('#contactform').submit(function(){
  5.  
  6.         var action = $(this).attr('action');
  7.  
  8.         $('#submit').attr('disabled','disabled').after('<img src="contact-form/assets/ajax-loader.gif" class="loader" />');
  9.  
  10.         $("#message").slideUp(750,function() {
  11.         $('#message').hide();
  12.  
  13.         $.post(action, {
  14.             name: $('#name').val(),
  15.             email: $('#email').val(),
  16.             phone: $('#phone').val(),
  17.             comments: $('#comments').val(),
  18.             verify: $('#verify').val()
  19.             challengeField: $("input#recaptcha_challenge_field").val();
  20.             responseField: $("input#recaptcha_response_field").val();          
  21.            
  22.         },
  23.        
  24.             function(data){
  25.                 document.getElementById('message').innerHTML = data;
  26.                 $('#message').slideDown('slow');
  27.                 $('#contactform img.loader').fadeOut('fast',function(){$(this).remove()});
  28.                 $('#submit').removeAttr('disabled');
  29.                 if(data.match('success') != null) $('#contactform').slideUp('slow');
  30.                
  31.                 // 2 functions added by TrueThemes
  32.                 if(data.match('success') != null) $("html,body").animate({
  33.                     scrollTop: $("#message").offset().top
  34.                     }, 1000, function(){
  35.                         //scroll complete function
  36.                     });
  37.                 if(data.match('success') == null) $("html,body").animate({
  38.                     scrollTop: $("#message").offset().top
  39.                     }, 1000, function(){
  40.                         //scroll complete function
  41.                     });
  42.                
  43.                
  44.  
  45.             }
  46.         );
  47.  
  48.         });
  49.  
  50.         return false;
  51.  
  52.     });
  53.  
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement