Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.delete_blog_post = function() {
- var _this = $(this);
- $('body').on('click', '.delete', function(e){
- e.preventDefault();
- var confirmation = confirm('Are you sure you want to delete this item?');
- var target = '.notify';
- if (confirmation) {
- $(this).parents(".odd").animate({ backgroundColor: "#fbc7c7" }, "fast").animate({ opacity: "hide" }, "slow");
- scroll_top( $(target) );
- var data = {
- post_id: $(this).attr('id'),
- //csrf_token: $('input[name="csrf_token"]').val()
- }
- $.post( base_url + 'admin/posts/delete_post', data, function( response ) {
- if(response === 'success'){
- $(target).html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-check"></i> Successfully updated!</h4></div>');
- _this.load_blog_posts(1);
- } else {
- $(target).html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><p><i class="icon fa fa-ban"></i> ' + response + ' </p></div>');
- }
- });
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement