Created
March 20, 2015 10:16
-
-
Save devjosh12/f1727ea82a4f8b9b48f2 to your computer and use it in GitHub Desktop.
custom js checked
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
$('.btnGetAll').live("click",function () { | |
if ($('.chkNumber:checked').length) { | |
var chkId = ''; | |
$('.chkNumber:checked').each(function () { | |
chkId += $(this).val() + ","; | |
}); | |
chkId = chkId.slice(0, -1); | |
//alert(chkId); | |
$.ajax({ | |
type:'POST', | |
url:'delete_products.php', | |
data:'delete_ids='+chkId, | |
success:function(data) { | |
if(data) { | |
alert(data); | |
location.reload(); | |
} else { // DO SOMETHING } | |
} | |
} | |
}); | |
} | |
else { | |
alert('Nothing Selected'); | |
} | |
}); | |
$('.chkSelectAll').live("click",function () { | |
$('.chkNumber').prop('checked', $(this).is(':checked')); | |
}); | |
$('.chkNumber').live("click",function () { | |
if ($('.chkNumber:checked').length == $('.chkNumber').length) { | |
$('.chkSelectAll').prop('checked', true); | |
} | |
else { | |
$('.chkSelectAll').prop('checked', false); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment