Created
December 20, 2014 13:23
-
-
Save maximilianoraul/7ff9eef129c0156d8277 to your computer and use it in GitHub Desktop.
AJAX Request
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
<script type="text/javascript"> | |
$('form').submit(function () { | |
$('form button').attr("disabled", "disabled"); | |
$('#loading').fadeIn(); | |
$('#msj').html(''); | |
$.post('<?php echo Flight::base_url('contacto'); ?>', $('form').serializeArray(), function (d) { | |
$('#loading').fadeOut(); | |
$('form button').removeAttr('disabled'); | |
$('#msj').html(d.msj); | |
$('html, body').animate({scrollTop: $("#msj").offset().top}, 500); | |
if (d.status === true) { | |
$('form').slideUp(); | |
} else { | |
$('#captcha').attr('src','<?php echo Flight::base_url('captcha'); ?>?' + Math.random()); | |
} | |
}, 'json'); | |
return false; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment