Welcome Guest, Not a member yet? Register   Sign In
Path to script files
#1

[eluser]danfloun[/eluser]
I'm using jquery.js and I'm just wondering how I can include these scripts without having to use the full site url in my .php files.

At the moment it only works if I do,

Code:
script src="http://localhost/jquery.js"></script

I want to just use src="jquery.js"

I tried moving the script to root folder (htdocs) but it never worked. In fact I moved it most places and it didn't work.

So how?

Secondly, whats going on with his forum. Everytime I post or edit, half of my scripts disappear?

Thanks

Danny
#2

[eluser]Delian Angelov[/eluser]
Try using this instead:
script src="/jquery.js"></script
#3

[eluser]Michael Wales[/eluser]
Common practice is to create an assets folder which houses all of your images, stylesheets, and script files.
A structure similar to:
Code:
assets
- css
- img
- js

Then use:
Code:
script src="/assets/js/jquery.js"></script

Personally, I just ditch the assets folder and place css, img, and js at the root level.




Theme © iAndrew 2016 - Forum software by © MyBB