Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 6th, 2012  |  syntax: jQuery  |  size: 1.02 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $('#errorreportform').on('submit', function(event){
  2.     var errorReportForm = $(this);
  3.     $.ajax({
  4.         url: '<?= site_url('error/notfound') ?>',
  5.         data: errorReportForm.serialize(),
  6.         type:'POST',
  7.         error: function(jqXHR, textstatus, errorThrown, response) {
  8.             $('#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')});
  9.             console.log("The following error occured: " + textstatus, errorThrown);
  10.             alert(textstatus);
  11.         },
  12.         success: function(textStatus) {
  13.             alert(textstatus);
  14.             $('#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')});
  15.             $('.errorreport').val('');
  16.         }
  17.     });
  18.     event.preventDefault();
  19. });