Mercurial > public > sg101
comparison 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 |
comparison
equal
deleted
inserted
replaced
98:d0d779dd0832 | 99:10d6182b9f6e |
---|---|
37 id = RegExp.$1; | 37 id = RegExp.$1; |
38 if (confirm('Only flag a post if you feel it is spam, abuse, violates site rules, ' + | 38 if (confirm('Only flag a post if you feel it is spam, abuse, violates site rules, ' + |
39 'or is not appropriate. ' + | 39 'or is not appropriate. ' + |
40 'A moderator will be notified and will review the post. ' + | 40 'A moderator will be notified and will review the post. ' + |
41 'Are you sure you want to flag this post?')) { | 41 'Are you sure you want to flag this post?')) { |
42 $.post('/forums/flag-post/', { id : id }, function(response) { | 42 $.ajax({ |
43 alert(response); | 43 url: '/forums/flag-post/', |
44 }, 'text'); | 44 type: 'POST', |
45 data: {id: id}, | |
46 dataType: 'text', | |
47 success: function (response, textStatus) { | |
48 alert(response); | |
49 }, | |
50 error: function (xhr, textStatus, ex) { | |
51 alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); | |
52 } | |
53 }); | |
45 } | 54 } |
46 } | 55 } |
47 return false; | 56 return false; |
48 }); | 57 }); |
49 $('#id_body').markItUp(mySettings); | 58 $('#id_body').markItUp(mySettings); |