Mercurial > public > sg101
comparison media/js/weblinks.js @ 165:952e05cb3d80
Implement #49; use POST for updating link hit counts. Also refactored a bit and use javascript to report broken links.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 03 Jan 2010 04:15:14 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
164:f7a6b8fe4556 | 165:952e05cb3d80 |
---|---|
1 $(document).ready(function() { | |
2 $('a.weblinks-broken').click(function () { | |
3 var id = this.id; | |
4 if (id.match(/^link-(\d+)$/)) { | |
5 id = RegExp.$1; | |
6 if (confirm('Do you really want to report this link as broken? ' + | |
7 'This will notify the site staff that the link is dead and that ' + | |
8 'it may need to be deleted or revised.')) { | |
9 $.ajax({ | |
10 url: '/links/report/' + id + '/', | |
11 type: 'POST', | |
12 dataType: 'text', | |
13 success: function (response, textStatus) { | |
14 alert(response); | |
15 }, | |
16 error: function (xhr, textStatus, ex) { | |
17 alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); | |
18 } | |
19 }); | |
20 } | |
21 } | |
22 return false; | |
23 }); | |
24 }); |