Advertisement
JonneOpettaja

jQuery3

Nov 5th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Handle the Ajax response
  2.  
  3. function submitFinished( response ) {
  4.   response = $.trim( response );
  5.   $('#sendingMessage').fadeOut(); }
  6.  
  7.   if ( response == "success" ) {
  8.  
  9.     // Form submitted successfully:
  10.     // 1. Display the success message
  11.     // 2. Clear the form fields
  12.     // 3. Fade the content back in
  13.  
  14.     $('#successMessage').fadeIn().delay(messageDelay).fadeOut();
  15.     $('#senderName').val( "" );
  16.     $('#senderEmail').val( "" );
  17.     $('#message').val( "" );
  18.  
  19.     $('#content').delay(messageDelay+500).fadeTo( 'slow', 1 );
  20.  
  21.   } else {
  22.  
  23.     // Form submission failed: Display the failure message,
  24.     // then redisplay the form
  25.     $('#failureMessage').fadeIn().delay(messageDelay).fadeOut();
  26.     $('#contactForm').delay(messageDelay+500).fadeIn();
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement