有人可以给我建议如何让它发挥作用吗?
<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>
最佳答案
浏览器必须加载完整的 DOM,然后才能使用 javascript 操作它,
在 Jquery 中使用 .ready()
$(document).ready(function()
{
$("#divpage").load("http://localhost:3000/annotation/testuser/demo.html");
});
关于javascript - 如何将 HTML 页面加载到 JSP 中的 DIV 中(不加载任何内容),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30089411/