
Untitled
By: a guest on
Apr 6th, 2012 | syntax:
jQuery | size: 1.02 KB | hits: 29 | expires: Never
$('#errorreportform').on('submit', function(event){
var errorReportForm = $(this);
$.ajax({
url: '<?= site_url('error/notfound') ?>',
data: errorReportForm.serialize(),
type:'POST',
error: function(jqXHR, textstatus, errorThrown, response) {
$('#postinfo').addClass('alert alert-error').html('<h4>Error</h4><p>Error report failed</p>').fadeOut(2000, function(){$(this).attr('style', '');$(this).html('');$(this).removeClass('alert alert-error')});
console.log("The following error occured: " + textstatus, errorThrown);
alert(textstatus);
},
success: function(textStatus) {
alert(textstatus);
$('#postinfo').addClass('alert alert-success').html('<h4>Success</h4><p>Your error report was sent successfully</p>').fadeOut(2000, function(){$(this).attr('style', '');$(this).html('');$(this).removeClass('alert alert-success')});
$('.errorreport').val('');
}
});
event.preventDefault();
});