Delete message by Ajax Qua 29 Out 2014 - 15:11
Only for testing purposes.
/***
* Fast delete post!
* Function: postDelete(post_ID)
*/
function postDelete(post_ID) {
var choice = confirm("Tem certeza de que deseja remover esta mensagem?");
if (choice){
$.post('/post', {
p: post_ID,
mode: "delete",
confirm: "Sim"
}).always(function() {
$('#post_' + post_ID).remove();
$('html,body').animate({
scrollTop: $('.post:last').offset().top
}, 1200);
});
}
};
var oDelete = $('a[href*="mode=delete"]');
oDelete.click(function(event) {
event.preventDefault();
var oLink = $(this).attr('href');
var choice = confirm("Tem certeza de que deseja remover esta mensagem?");
if(choice) {
$.post(oLink, {
confirm: 1
}).success(function() {
var ID = oLink.match(/p\=(\d+)/g)[0].split('=')[1];
$('.post--' + ID).remove();
$('html, body').animate({
scrollTop: $('.post:last').offset().top - 55
}, 700);
});
};
});