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