gremmie@1: $(document).ready(function() { gremmie@1: $('.gcal-del').click(function () { gremmie@1: if (confirm('Really delete this event?')) { gremmie@1: var id = this.id; gremmie@1: if (id.match(/gcal-(\d+)/)) { bgneal@150: $.ajax({ bgneal@150: url: '/calendar/delete/', bgneal@150: type: 'POST', bgneal@150: data: { id : RegExp.$1 }, bgneal@150: dataType: 'text', bgneal@150: success: function (id) { bgneal@150: var id = '#gcal-' + id; bgneal@150: $(id).parents('li').hide('normal'); bgneal@150: }, bgneal@150: error: function (xhr, textStatus, ex) { bgneal@150: alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + bgneal@150: xhr.responseText); bgneal@150: } bgneal@150: }); gremmie@1: } gremmie@1: } gremmie@1: return false; bgneal@150: }); gremmie@1: });