I put this switchery
library in my project, I can capture the change event of the checkbox, but do not make it disappear if it goes back unchecked.
$('.js-switch-small').on('click',function() {
var ted = $(this);
var id = ted.attr('id');
var status = ted.prop( "checked");
$.ajax({
url : "post.phpp",
type: "POST",
data: {
user: id,
status:status,
},
dataType: 'json',
error: function(data){
alert('error '+status);
//entra em loop
$(ted).trigger('click');
},
success: function(data){
alert('sucesso');
//$('#retorno').html(data);
}
});
});