@section scripts {
<script>
$(function() {
$('.toggle').change(function() {
var self = $(this);
var url = self.data('url');
var id = self.attr('id');
var value = self.prop('checked');
$.ajax({
url: url,
data: { id: id },
type: 'POST',
success: function(response) {
alert(response);
}
});
});
});
</script>
}