Skip to content

Instantly share code, notes, and snippets.

@taleeb35
Last active August 29, 2015 14:06
Show Gist options
  • Save taleeb35/2823ebab0cc6a32e4e71 to your computer and use it in GitHub Desktop.
Save taleeb35/2823ebab0cc6a32e4e71 to your computer and use it in GitHub Desktop.
Fade in Message
$(document).ready(function() {
$('a.delete').click(function(e) {
var __this = this;
e.preventDefault();
var parent = $(this).parent("td").parent("tr");
$.ajax({
type: 'get',
url: $(__this).attr("href"),
dataType: 'json',
beforeSend: function() {
parent.animate({'backgroundColor':'#fb6c6c'},1000);
},
success: function(response) {
if(response.success){
alert("Are you sure to delete the user?");
$('.message').delay(1000).hide('highlight', {color: '#66cc66'}, 1500);
parent.slideUp(3000,function() {
parent.remove();
});
}else{
alert("Failed to delete the user");
parent.animate({'backgroundColor':'#fff'},1000);//Restore your background back
}
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment