Adsense
Popular Posts
- Install APXS in Redhat Linux
- MySQL workbench -"Could not decrypt password cache"
- Transfer modules between sites
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- datatable order by nunmeric
- MySQL date created and date modified
- super(props) in React
- PHP, dump varailbes in a format way
- React: connect(mapStateToProps, mapDispatchToProps)
Thursday, May 12, 2016
jQuery, prevent many click fireup
Use jQuery function die to prevent many clicks fire at the same time:
example
$('#popup_9sp .modal-body .delete').die('click');
$('#popup_9sp .modal-body .delete').live('click', function(){
var id = $(this).parents('tr').attr('data-id');
var answer = confirm("Are you sure to delete this row?")
if(id>0 && answer){
$('#tab1').find('.cid'+id).remove();
}
var postdata = {funct: 'DeleteCourse', id:id};
var url = '../_ajaxParts/preplanning/preplanning_summary.php';
if(id>0 && answer){
$.post(url, postdata, function(data) {
if(data=='fail')
$("div#notice").html('Delete failed!');
else{
$("div#notice").html('Delete successfully.');
}
$("div#notice").css('display', 'block');
$("div#notice").fadeOut(15000);
});
}
if (answer)
$(this).parents('tr').css('display','none');
});
});
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment