I have main html document:
<html><head></head>
<body>
<div id="content">
</div>
</body>
</html>
Also I have a content file (not the html document, just html code):
<div class="CodeRay">
<div class="code"><pre><span class="no"> 1</span> require
....
</pre></div>
I want to add the content file to html document like here:
<html><head></head>
<body>
<div id="content">
<div class="CodeRay">
<div class="code"><pre><span class="no"> 1</span> require
....
</pre></div>
</div>
</body>
</html>
How to use jQuery to accomplish this task? Also I need to run this site localy. Thanks.
EDIT: Locally means like this "file:///E:/Work/ReadTheCode/main.html"
Use jQuery's .load()
function. The code would probably look something like this:
$(document).ready(function(){
$('#content').load('contentFile.html');
});
If you need more info, here is the link to jquery's load documentation.
you can use something like this:
$('#result').load('ajax/test.html');
See: http://api.jquery.com/load/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With