I know this is possible, and I looked through numerous examples. And I'm afraid I already know the answer to my question, but maybe I missed something. I thought this did not work because I am running this code locally and not on the server.
In my tag:
<script type="text/javascript" src="jquery-1.5.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#test").load("test.html");
} );
</script>
In my body tag:
<div id="test"></div>
My external code (inside 'test.html ")
<div>This is what you should be seeing!</div>
Doesn't that work? In addition, in my external html document, I need to configure it with all the additional tags so that the document looks like this:
<html>
<head>
<title>
</title>
</head>
<body>
<div>This is what you should be seeing!</div>
</body>
</html>
All my files are in the same directory.
Thank.
source
share