Created
June 25, 2015 16:01
-
-
Save sdglhm/31383092286168f5b6bc 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
<script type="text/javascript"> | |
$(function () { | |
$('form').on('submit', function (e) { | |
e.preventDefault(); | |
//added comment to show usage | |
$.ajax({ | |
type: 'post', | |
url: 'src/secure_function.php', | |
data: $('form').serialize(), | |
success: function (data) { | |
$('#result').html(''); | |
$('#result').html(data); | |
var str = data.match('<div class="alert alert-success alert-dismissable fadeIn"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><strong>Email sent successfully! We will contact you as soon as possible.</div>') | |
if (str) {document.getElementById("contact_frm").reset();}; | |
} | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment