XF 1.5 Javascript Include not work!

Lionzero

Member
Hello,

today i had a problem by including an external JavaScript on my Webspace.

The script is placed under ../js/jquery/myscript.js

If i include it in footer template, i will see nothing.

Include Codes tested :

<xen:require js="alert.js" />

and

<script src="../js/jquery/alert.js" />

Any idea ?
 
Last edited:
You need to include the path, like so:
HTML:
<xen:require js="js/jquery/myscript.js" />


Or you can add it to the template directly between script tags, like so:
HTML:
<script type="text/javascript">
    JS here
</script>
 
I saw your original post sir. But you were adviced to add the paths correctly. And that is why I said to post the code as you are using it. If you are using the original code, then it will not work. Please see the posts by @Brogan above and correct your code.
 
You need an Example, i give you 3 Examples, 2 in first poost and 1 in quote, what you not understand if the example path is exact that path but the scriptname is not myscript... MAN !!!!!
 
You need an Example, i give you 3 Examples, 2 in first poost and 1 in quote, what you not understand if the example path is exact that path but the scriptname is not myscript... MAN !!!!!

I am sorry sir, but you are not making much sense to me. You are saying that the footer template is the path, when in fact it is not. I was just trying to help. It is no need for yelling and getting irritated. Anyways, I will be unwatching this thread as my help does not seem to be appreciated. Good luck.
 
I don't see a reason to be so edgy to be honest, we're trying to help you, but you kinda ignore all advices given.

I'll try to explain you what's going on:
  • As from your first post, it doesn't get clear if your script is named myscript.js or alert.js - that's obviously important to embedd it. Clarify that for yourself in order to get it working
  • To embedd the script insert
    Code:
    <xen:require js=“js/jquery/NAME.js“ />
    into your footer template. Replace NAME with either alert or myscript, depending on how your file is named. Make sure that the coe is exactly as above.
If it is still not working, one of the following might be the case:
  • Your jQuery-File is broken due to some circumstances, probably the code within it is not working. Tp check if this is the case, add
    Code:
    console.log('Test');
    to the beginning of that file and check the developer console (F12 in most browsers)
  • If the console is empty, you're likely using the wrong path. The path is where your script file is effectively stored (e.g. above it's js/jquery/NAME.js) Check for correct folders, Spelling, capitalization, etc.
 
6WJxpSp.png


VvkIqER.png


I now how to include a script, fact is, that this JavaScript not work by including it in Xenforo !

I was testing the script before upload it ...
 
Back
Top Bottom