Uncaught ReferenceError: $ is not defined at myPage.html

I am trying to write below jQuery code for my website.

<html><head>
<script type="text/javascript">
$(document).ready(function () {
$('#danger').click(function(){
     alert("Danger Button Clicked");
    });
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.2/jquery.min.js" ></script>
</head>
<body>
<a href="#" id="danger">Danger</a>
</body>
</html>

But it is always throwing below error and nothing happens. Please help!!!

Uncaught ReferenceError: $ is not defined at myPage.html