Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#contact-form').submit(function(e) {
- //if ketchup validates
- if( $('#contact-form').ketchup("isValid") ) {
- //serialize the form data and add an ajax variable
- formData = $(this).serialize() + '&ajax=1';
- //send the form via ajax
- $.post($('#contact-form').attr('action'),formData, function(response){
- if(response=='1') {
- //do some stuff here
- console.log('success');
- } else {
- //got some erros
- var json = jQuery.parseJSON(response);
- console.log(response);
- }
- });
- }
- //don't submit normally
- return false;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement