Simple Ajax test is not working
Hi guys,
Could please some one help me to understand why this code is not working?:
- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Your Title</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script>
</head>
<body>
<input type="button" value="Click me to load the content of another page via Ajax" id="myBtn">
<div id="content"></div>
<script type="text/javascript">
$(document).ready(function(){
$("#myBtn").click(function(){
$.ajax({
url: "anotherPage.html",
success: function(data) {
$("#content").html(data);
}
});
});
});//End of document ready
</script>
</body>
</html>
Content of anotherPage.html:
- <strong>I'm coming from another file.</strong>
Thanks a lot for your help