<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : Loading custom JS script in plugins</title>
		<link>https://www.cotonti.com</link>
		<description>Last topic posts</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Thu, 16 Apr 2026 12:57:18 -0000</pubDate>

		<item>
			<title>ez</title>
			<description><![CDATA[Didn't know that one yet... thnx<br />
<br />
You can also load additional css (e.g. for plugins)<br />
<div class="highlight"><pre class="js">
$.ajax({
  url: url,
  dataType: 'script',
  success: success
});
</pre></div>
<br />
thnx trustmaster]]></description>
			<pubDate>Fri, 26 Feb 2010 16:03:08 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=5351&d=0#post23219]]></link>
		</item>
		<item>
			<title>Trustmaster</title>
			<description><![CDATA[Yes, thanks for popping it in our minds! There's also a <a href="http://api.jquery.com/jQuery.getScript/" rel="nofollow">jQuery.getScript()</a> function, which uses AJAX to load files.<br />
<br />
We'll try this solution in trunk and see how it works.]]></description>
			<pubDate>Fri, 26 Feb 2010 06:40:26 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=5351&d=0#post23214]]></link>
		</item>
		<item>
			<title>ez</title>
			<description><![CDATA[I found this usefull.. and will share it with you  <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/smile.gif" alt=":)" /> <br />
<br />
If you need a custom js script for a plugin, DO NOT load it always in the header.tpl...<br />
OR {HEADER_COMPOPUP} tags, you CAN load jquery plugins or other scripts only when you really need them with the following code:<br />
<br />
<div class="highlight"><pre class="js">
function addJavascript(jsname,pos) {
	var th = document.getElementsByTagName(pos)&#091;0&#093;;
	var s = document.createElement('script');
	s.setAttribute('type','text/javascript');
	s.setAttribute('src',jsname);
	th.appendChild(s);
}
</pre></div>
<br />
look at: <a href="http://javascript.about.com/library/bladdjs.htm" rel="nofollow">Link to article</a><br />
<br />
So keep your code clean, and only load stuff when needed..  <img class="aux smiley" src="https://www.cotonti.com/./images/smilies/sunglasses.gif" alt="B)" />]]></description>
			<pubDate>Fri, 26 Feb 2010 05:26:56 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=5351&d=0#post23213]]></link>
		</item>
	</channel>
</rss>