vendredi 15 novembre 2019

Cant confirm delete with swal on laravel

hey guys i have a little probleme with swal condition when the user confirm the delete nothing happen (swal version 7.0.7) there is the swal code

<form id="del_type" action="" method="post"style="display: inline">
     {!! method_field('delete') !!}
     
<button class="btn btn-danger  delete_type" type="submit" >Supprimer</button>
</form>
<script>
$(".delete_type").click( function (e) {
            e.preventDefault();
            var _this = $(this)

            //console.info(_this.parent().prop('action'))
            swal({
            title: "Attention",
            text: "Veuillez confirmer la suppression",
            type: "warning",
            showCancelButton: true,
            confirmButtonText: "Confirmer",
            cancelButtonText: "Annuler",
            }, function(result) {
                if(result) {
                    $('#del_type').submit();
                } else {
                    swal('cancelled');
                }
            });


});
</script>

when i click on the delete button it shows the swal with the confirm and cancel button but when you click on confirm nothing happens and there's no submit (and sorry for my english)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire