mercredi 17 juillet 2019

Loading html inside sweet alert?

Here is my code for callling Swal:

window.swal({
    title: "Checking...",
    text: "Please wait",
    imageUrl: "",
    showConfirmButton: false,
    allowOutsideClick: false
});
$.ajax({
    type: 'POST',
    url: '/' + target,
    data: {
        data: true
    },
    success: function(response) {
        window.swal({
            type: 'info',
            width: 900,
            padding: '3em',
            html: response,
            showCloseButton: true,
            focusConfirm: false,
        });
    },
    error: function(response) {
    }
});

Basically I'm making an ajax request that does a return view('index', compact('data')); in the controller.

The html that I'm trying to load inside Swal has a <script src="my-file.js"></script> inside it, but it does not get loaded when Swal is fired, so no events get fired when I click inside.

I've tried looking in the docs but I can't find anything. How will I get swal to load that file?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire