Mercurial > public > sg101
diff media/js/forums.js @ 99:10d6182b9f6e
Forums: added error handling to the flagging of posts. Did the same with the comments function too.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 14 Sep 2009 00:06:08 +0000 |
parents | d0d779dd0832 |
children | e94398f5e027 |
line wrap: on
line diff
--- a/media/js/forums.js Sun Sep 13 21:45:35 2009 +0000 +++ b/media/js/forums.js Mon Sep 14 00:06:08 2009 +0000 @@ -39,9 +39,18 @@ 'or is not appropriate. ' + 'A moderator will be notified and will review the post. ' + 'Are you sure you want to flag this post?')) { - $.post('/forums/flag-post/', { id : id }, function(response) { - alert(response); - }, 'text'); + $.ajax({ + url: '/forums/flag-post/', + type: 'POST', + data: {id: id}, + dataType: 'text', + success: function (response, textStatus) { + alert(response); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); + } + }); } } return false;