Experimenting with JS/Jquery and the JQuery .get function. I'm getting the pop up/alert to open but there is no text after "Data Loaded:"
What am I missing?
I have a .js file (called lab1.js) that looks like this:
var person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
document.getElementById("demo").innerHTML =
person + "'s Favorite Links:";
}
$(document).ready(function(){
$.get("/Users/rabdelaz/Desktop/Labs/lab1.txt", function(data){
alert("Data Loaded: " + data);
});
});
With the following in my lab1.txt file:
"a line of text of your choosing"
Finally here is my html:
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="lab1.css">
<meta charset="utf-8"/>
<title>Lab 1</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
</head>
<body>
<p id="demo"></p>
<ul>
<li><a href="http://www.akamai.com">www.akamai.com</a></li>
<li><a href="http://aloha.akamai.com">aloha.akamai.com</a></li>
<li><a href="http://agora.akamai.com">agora.akamai.com</a></li>
<li><a href="http://ask.akamai.com">ask.akamai.com</a></li>
<li><a href="http://luau.akamai.com">luau.akamai.com</a></li>
<li><a href="http://mydrive.akamai.com">mydrive.akamai.com</a></li>
<li><a href="http://act.akamai.com">act.akamai.com</a></li>
<li><a href="http://tools.gss.akamai.com/portal">GSS Tools</a></li>
</ul>
<script src="lab1.js"></script>
</body>
</html>