comparison media/js/comments.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 dbd703f7d63a
children b0d62247c3e4
comparison
equal deleted inserted replaced
98:d0d779dd0832 99:10d6182b9f6e
27 id = RegExp.$1; 27 id = RegExp.$1;
28 if (confirm('Only flag a comment if you feel it is spam, abuse, violates site rules, ' + 28 if (confirm('Only flag a comment if you feel it is spam, abuse, violates site rules, ' +
29 'or is not appropriate. ' + 29 'or is not appropriate. ' +
30 'A moderator will be notified and will review the comment. ' + 30 'A moderator will be notified and will review the comment. ' +
31 'Are you sure you want to flag this comment?')) { 31 'Are you sure you want to flag this comment?')) {
32 $.post('/comments/flag/', { id : id }, function(response) { 32 $.ajax({
33 alert(response); 33 url: '/comments/flag/',
34 }, 'text'); 34 type: 'POST',
35 data: {id: id},
36 dataType: 'text',
37 success: function (response, textStatus) {
38 alert(response);
39 },
40 error: function (xhr, textStatus, ex) {
41 alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText);
42 }
43 });
35 } 44 }
36 } 45 }
37 return false; 46 return false;
38 }); 47 });
39 $('#id_comment').markItUp(mySettings); 48 $('#id_comment').markItUp(mySettings);