Warning: The author of this contribution does not provide support for it anymore.

Breizh Ajax Checks

move js file out of templates folder - Breizh Ajax Checks

move js file out of templates folder

by elvis_ef » Tue Jun 24, 2014 5:42 am

Hello. I have a small issue with your code, Author. I wanted to move all js files to one folder only, therefore I needed to change my include param in my file. So I created "ajax_checks.html" in the templates folder with the code:

<!-- IF S_IN_AJAX_CHECKS -->
<script type="text/javascript">
// <![CDATA[
<!-- INCLUDE ajax_checks.js -->
// ]]>
</script>
<!-- ENDIF -->


to include it on register and profile register info pages ONLY. As the include directive would not work if I do such thing (js file is now in {ROOT}/scripts folder):

<!-- INCLUDE ../../../ajax_checks.js -->


so the best way I found to fix this is to put all JS into ajax_checks.html file, as a replacement for the line: "<!-- INCLUDE ajax_checks.js -->". But this does not work on the site saying:

"Uncaught TypeError: Cannot read property 'setAttribute' of undefined"

both on Firefox and Chrome.

How to solve this? All other scripts are being loaded on that certain page of course.
The best way I want it to work is to have a separate js file in the root/scripts folder, and then include it in the template file, is it possible? How to include the javascript file with subfolders reading?
User avatar
elvis_ef
Registered User
Posts: 44
Joined: Sun Feb 13, 2011 10:08 am
Contact: