Created
March 21, 2016 02:30
-
-
Save charrondev/2e0352aa88a1590b11ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hijack the form submit to add a callback. | |
$('#appointment-form').submit((event) => { | |
$.ajax({ | |
url: $('#appointment-form').attr('action'), | |
type: 'post', | |
data: $('#appointment-form').serialize(), | |
success: () => { | |
$(document.body).toggleClass('appointments-open'); | |
}, | |
error: () => { | |
$('.appointment__error').toggleClass('appointment__error-visible'); | |
} | |
}); | |
event.preventDefault(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment