External html file not showing for local client side include

226 Views Asked by At

I have an index.html file which I am trying to add a client side include for my footer using JavaScript. However, my "footer.htm" include is not displaying, just the text is. I am pretty sure there is an issue with my JavaScript code. I know there is no problem with my footer.htm file. Please Help!

document.write('footer.htm');
<div id="Footer">
  <script type="text/javascript" language="javascript" src="footer.js">
  </script>
</div>

1

There are 1 best solutions below

0
On

Assuming you are using jQuery

<script type="text/javascript">
    $(document).ready(function(){
       $('#footer').load('footer.htm');
    });
</script>