Swal.fire({ position: 'top-end', icon: 'success', title: 'Categorie has been saved', showConfirmButton: false, timer: 1500 }).then(function() { location.reload(); }); code example

Example 1: sweet alert 2 do action on confirm

Swal.fire({  
  title: 'Do you want to save the changes?',  
  showDenyButton: true,  showCancelButton: true,  
  confirmButtonText: `Save`,  
  denyButtonText: `Don't save`,
}).then((result) => {  
	/* Read more about isConfirmed, isDenied below */  
    if (result.isConfirmed) {    
    	Swal.fire('Saved!', '', 'success')  
    } else if (result.isDenied) {    
    	Swal.fire('Changes are not saved', '', 'info')  
 	}
});

Example 2: swal({

swal("Here's a message!", "It's pretty, isn't it?")

Tags:

Html Example