I’ve been playing around with the Jquery framework lately. I’m not a big JavaScript guy as my primary focus for the past few years now has been ActionScript/Flash/Flex. But I have to admit, Jquery (and I’m sure some of the other more robust JavaScript frameworks) is really nice.
Anyways, here’s how to load in an external html file into a div:
<script type=”text/javascript” src=”jquery-1.2.6.js”>
</script>
<script type=”text/javascript”>
$(document).ready(function(){
$(function () {
$(”#content”).load(”content.html”);
});
});
</script>
Here is the content.html file:
<html>
<head>
</head>
<body>
<h1>Here is my text file!</h1>
<p>Here is the second line of it!</p>
<p><strong>And the third!</strong></p>
</body>
</html>
Simple content management? Or is that an SEO no-no? I’m used to loading, parsing, and displaying XML via Flash. I’ll have to look into whether Jquery can do that too.
One Comment
Easy and clean. Wouldn’t use to include any actual content that needs to be accessible and indexed by search engines but good for applications and interactive prototypes. Also ads could be inserted into the page after it has loaded to avoid troubles with slow ad-hosting services.