Reputation: 1
Can anybody give me advice on how to make it work?
<html>
<head>
<script src="../js/jquery-1.9.1.js"></script>
</head>
<body>
<div id="divpage"></div>
<script>
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
alert( "Load was performed." );
</script>
</body>
</html>
Upvotes: 0
Views: 1856
Reputation:
The browser has to load the full DOM, before you can manipulate it with javascript,
In Jquery use .ready()
$(document).ready(function()
{
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
});
Upvotes: 2
Reputation: 3932
Move your script block out of the body and up in the head section. Then, wrap your JQuery like this:
<script>
$(document).ready(function()
{
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
alert( "Load was performed." );
});
</script>
Upvotes: 0