Skip to main content

Bug Tracker

Side navigation

#14526 closed bug (notabug)

Opened November 08, 2013 05:54PM UTC

Closed November 10, 2013 06:48PM UTC

JQuery .load() - Script Tag Error

Reported by: bryancounts@icloud.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

I have two pages, (1) home.html (2) includes/footer.html

I am trying to use the .load() function to load the footer file into the home page file so I do not have to replace the footer on each site page everytime I make a change to it.

I am using the current code to .load() successfully:

<div class="footer_load"> 
  <script>
  $('.footer_load').load('includes/footer.html');
  </script> 
</div>

However, when I load the footer everything comes through properly but the <script> tags that are inserted into the page. How can I re-write my code to not only import the HTML but also all other content like <script> tags that may be present.

My footer page looks like such, you can see the script tag that is used to help auto-update the copyright year. Please note the other half of the <script> defining the year attributes is located on the home.html page ... I just need the .load() function to import the half found on the footer.html page so it will all work together and render the year, while loading all the other content too.

<footer>
  <div id="copyright"><span>Copyright © <script type="text/javascript"><!--- Hide from old browsers
    document.write(y0);// end hiding ---> 
    </script> Film, Stage & Showbiz Expo LLC. All Rights Reserved. All other<br>
    trademarks are the property of their respective owners and are used with their permission.
</footer>
Attachments (0)
Change History (1)

Changed November 10, 2013 06:48PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

Please ask for help on a forum. You can't document.write() something in a template that you .load(). Scripts in a template are a bad idea in general.