function removed_confrm(id, company){
var the_url = "";
var view = "";
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false },
function() {
$.ajax({
type: "GET",
data: {
'company_id': id
},
url: the_url,
success: function(data) {
if (data == id) {
swal("Deleted!", "Your "+company+" has been deleted.", "success");
location.reload();
}
},
error: function(data) {
swal("We cannot delete!", "Your "+company+" file has not been deleted.", "error");
}
});
}
);
}
This case the sweetalert will exit and then the location.reload will execute, I would like to click the okay first the execute location.reload.
Hi,
Did you tried attaching a function to the confirm button as described in official website?
In your case I guess something like the following would do the trick:
swal({
title: "Deleted!",
text: "Your "+company+" has been deleted.",
type: "success"
}, function(){
location.reload();
});
Yes This works for me
Most helpful comment
Hi,
Did you tried attaching a function to the confirm button as described in official website?
In your case I guess something like the following would do the trick:
swal({ title: "Deleted!", text: "Your "+company+" has been deleted.", type: "success" }, function(){ location.reload(); });