Sweet Alert
swal('Hello world!');
swal("Good job!", "You clicked the button!", "success");
swal("Good job!", "You clicked the button!", "warning");
swal("Good job!", "You clicked the button!", "error");
swal("Good job!", "You clicked the button!", "info");
swal({ title: "Are you sure?", text: "Once deleted, you will not be able to recover this imaginary file!", icon: "warning", buttons: true, dangerMode: true,}) .then((willDelete) =>{ if (willDelete) { swal("Poof! Your imaginary file has been deleted!", { icon: "success", }); } else { swal("Your imaginary file is safe!", { icon: "error",});
swal("Write something here:", { content: "input",}) .then((value) =>{ swal(`You typed: ${value}`);
swal({ text: 'Search for a movie. e.g. "La La Land".', content: "input", button: { text: "Search!", closeModal: false, },}) .then(name =>{ if (!name) throw null; return fetch(`https://itunes.apple.com/search?term=${name}&entity=movie`); }) .then(results =>{ return results.json(); }) .then(json =>{ const movie = json.results[0]; if (!movie) { return swal("No movie was found!"); } const name = movie.trackName; const imageURL = movie.artworkUrl100; swal({ title: "Top result:", text: name, icon: imageURL, }); }) .catch(err =>{ if (err) { swal("Oh noes!", "The AJAX request failed!", "error"); } else { swal.stopLoading(); swal.close(); } });