Skip to content

Instantly share code, notes, and snippets.

@davidoster
Last active January 23, 2021 18:57
Show Gist options
  • Save davidoster/3dbf69b875b1db400c95c923136ae96e to your computer and use it in GitHub Desktop.
Save davidoster/3dbf69b875b1db400c95c923136ae96e to your computer and use it in GitHub Desktop.
Playing around
<!DOCTYPE HTML>
<HTML>
<HEAD></HEAD>
<BODY>
<!-- doesn't work!!! <a href="" onclick='onDelete("http://localhost:3000/books/delete/1")'> Delete</a> -->
<button onclick='onDelete("http://localhost:3000/books/delete/1")'> Delete</button>
<SCRIPT>
function onDelete(url) {
var dialog = confirm("Are you sure you want to delete this book?");
if(dialog) {
console.log("ok");
//window.location.replace("https://in.gr");
window.location.replace(url);
} else console.log("nok");
}
</SCRIPT>
</BODY>
</HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment