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>
2 个解决方案
#1
2
The browser has to load the full DOM, before you can manipulate it with javascript, In Jquery use .ready()
浏览器必须加载完整的DOM,然后才能使用javascript操作它,在Jquery中使用.ready()
$(document).ready(function()
{
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
});
#2
0
Move your script block out of the body and up in the head section. Then, wrap your JQuery like this:
将脚本块移出主体并向上移动到头部。然后,像这样包装你的JQuery:
<script>
$(document).ready(function()
{
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
alert( "Load was performed." );
});
</script>
#1
2
The browser has to load the full DOM, before you can manipulate it with javascript, In Jquery use .ready()
浏览器必须加载完整的DOM,然后才能使用javascript操作它,在Jquery中使用.ready()
$(document).ready(function()
{
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
});
#2
0
Move your script block out of the body and up in the head section. Then, wrap your JQuery like this:
将脚本块移出主体并向上移动到头部。然后,像这样包装你的JQuery:
<script>
$(document).ready(function()
{
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
alert( "Load was performed." );
});
</script>