Problem with switchery library

1

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);
        }
    });
});
    
asked by anonymous 25.03.2016 / 23:28

1 answer

0

Just remove the checked property from the checkbox.

    
20.06.2017 / 22:57