Created
October 13, 2016 16:31
-
-
Save d1i1m1o1n/7aee4a3285fe50802f52e1c6f1e96dc7 to your computer and use it in GitHub Desktop.
Test
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
$(document).on('click', '#submit_feedback_form', function(e) { | |
e.preventDefault(); | |
var empty_input = 0; | |
$('#feedback_form_content input[type=text], #feedback_form_content textarea').each(function(i, el) { | |
if($(el).val() == "") { | |
empty_input = 1; | |
} | |
}); | |
if(empty_input == 0) { | |
var url_data = $('#feedback_form_content form').serialize(); | |
$.ajax({ | |
type: "GET", | |
url: "/feedback_form.php?" + url_data, | |
success: function(data) { | |
$('#feedback_form_content').html(data); | |
var display_img = $('.feedback_form_success_wrap').data('display'); | |
if(display_img) { | |
$('.feedback_form_success_wrap').fadeIn('slow'); | |
} | |
}, | |
complete: function() { | |
setTimeout(function() { | |
$('.feedback_form_success_wrap').fadeOut('slow'); | |
}, 2000); | |
}, | |
error: function() { | |
alert('Ошибка!'); | |
} | |
}); | |
} else { | |
alert('Все поля формы должны быть заполнены!'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment