cotonti.com : Loading custom JS script in plugins https://www.cotonti.com Последние сообщения в теме Cotonti en Mon, 27 Oct 2025 23:06:34 -0000 ez
You can also load additional css (e.g. for plugins)
$.ajax({
  url: url,
  dataType: 'script',
  success: success
});

thnx trustmaster]]>
пт, 26 фев 2010 16:03:08 -0000
Trustmaster jQuery.getScript() function, which uses AJAX to load files.

We'll try this solution in trunk and see how it works.]]>
пт, 26 фев 2010 06:40:26 -0000
ez

If you need a custom js script for a plugin, DO NOT load it always in the header.tpl...
OR {HEADER_COMPOPUP} tags, you CAN load jquery plugins or other scripts only when you really need them with the following code:

function addJavascript(jsname,pos) {
	var th = document.getElementsByTagName(pos)[0];
	var s = document.createElement('script');
	s.setAttribute('type','text/javascript');
	s.setAttribute('src',jsname);
	th.appendChild(s);
}

look at: Link to article

So keep your code clean, and only load stuff when needed.. B)]]>
пт, 26 фев 2010 05:26:56 -0000