lundi 23 juillet 2018

How to call a function inside a swal success? in jquery

my function is ignored and when i console it, it will display undefined.

here is the jquery syntax.

swal({
    title: "Are you sure?",
    text: "You will not be able to recover this record!",
    type: "warning",
    showCancelButton: true,
    confirmButtonClass: "btn-danger",
    confirmButtonText: "Yes, delete it!",
    cancelButtonText: "No, cancel!",
    closeOnConfirm: false,
    closeOnCancel: false
    },
    function(isConfirm) {
    if (isConfirm) {
      // this.$http.delete();
      window.axios.post(`/delete-sl-gl/${brcode}/${slc}/${slt}/${sle}/${cts}`)
        .then(response => {
        // console.log(response.data.sle)
          if (response.data.success === true) {
            swal('Deleted', response.data.message, 'success'); 
            //console.log(response.data.sle)
            spliceSLE_gl(sle.sle);
          }

        })
        .catch(error =>{
        console.log(error.response)
        });
    } else {
      swal("Cancelled", "Your file is safe :)", "error");
    }

i got an error / ignored in spliceSLE_gl(sle.sle);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire