javascript - JQuery not loading data when $.get is called -
experimenting js/jquery , jquery .get function. i'm getting pop up/alert open there no text after "data loaded:"
what missing?
i have .js file (called lab1.js) looks this:
var person = prompt("please enter 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 following in lab1.txt file:
"a line of text of choosing"
finally here 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>
Comments
Post a Comment