I am creating an add and delete button, when you can add above the picture it says please add and when you can delete it says please delete. I am stuck however on how to be able to make it work. What I got works when you add but not when you delete:
$('.button a').click(function() {
var url = $(this).attr('href');
var info = $(this).attr('rel');
var cct = $.cookie("<?php echo $this->config->item('csrf_cookie_name'); ?>");
$.get(url, {<?php echo $this->security->get_csrf_token_name(); ?>: cct}, function() {
$('.button a').empty().addClass('delete');
$('.addText').empty().html(info);
});
return false;
});
The html
<div class="addText">please add</div>
<div class="button"><a href="cabinet/add/180" class="add" rel="please delete"></a></div>