Mercurial > public > sg101
annotate gcalendar/static/js/gcalendar_edit.js @ 581:ee87ea74d46b
For Django 1.4, rearranged project structure for new manage.py.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 May 2012 17:10:48 -0500 |
parents | gpp/gcalendar/static/js/gcalendar_edit.js@88b2b9cb8c1f |
children | 110bbc78a482 |
rev | line source |
---|---|
bgneal@312 | 1 $(document).ready(function() { |
bgneal@312 | 2 $('.gcal-del').click(function () { |
bgneal@312 | 3 if (confirm('Really delete this event?')) { |
bgneal@312 | 4 var id = this.id; |
bgneal@312 | 5 if (id.match(/gcal-(\d+)/)) { |
bgneal@312 | 6 $.ajax({ |
bgneal@312 | 7 url: '/calendar/delete/', |
bgneal@312 | 8 type: 'POST', |
bgneal@312 | 9 data: { id : RegExp.$1 }, |
bgneal@312 | 10 dataType: 'text', |
bgneal@312 | 11 success: function (id) { |
bgneal@312 | 12 var id = '#gcal-' + id; |
bgneal@312 | 13 $(id).parents('li').hide('normal'); |
bgneal@312 | 14 }, |
bgneal@312 | 15 error: function (xhr, textStatus, ex) { |
bgneal@312 | 16 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + |
bgneal@312 | 17 xhr.responseText); |
bgneal@312 | 18 } |
bgneal@312 | 19 }); |
bgneal@312 | 20 } |
bgneal@312 | 21 } |
bgneal@312 | 22 return false; |
bgneal@312 | 23 }); |
bgneal@312 | 24 }); |