Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Correct path for external JavaScript files?
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Correct path for external JavaScript files?
Correct path for external JavaScript files?
19-04-2013 9:30 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
A page using jQuery runs on Apache on my computer but doesn't on ccgi.myname.plus.com.
I've done some tests and this
runs -- even when (all files are) moved into a subdirectory Test1.
This
doesn't -- even with the variations for the path to the JavaScript files as
which works on my computer as the directory containing test2.html has a js subdirectory containing the two JavaScript files.
Anyone have any ideas?
Chris
I've done some tests and this
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="jquery.js"></script>
<script src="test1.js"></script>
</body>
</html>
runs -- even when (all files are) moved into a subdirectory Test1.
This
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test 2</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="/Test2/js/jquery.js"></script>
<script> src="/Test2/js/test2.js"</script>
</body>
</html>
doesn't -- even with the variations for the path to the JavaScript files as
src="js/jquery.js">
which works on my computer as the directory containing test2.html has a js subdirectory containing the two JavaScript files.
Anyone have any ideas?
Chris
Message 1 of 3
(4,367 Views)
2 REPLIES 2
Re: Correct path for external JavaScript files?
20-04-2013 2:32 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: wynnmc This <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test 2</title>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="/Test2/js/jquery.js"></script>
<script> src="/Test2/js/test2.js"</script>
</body>
</html>
doesn't -- even with the variations for the path to the JavaScript files assrc="js/jquery.js">
which works on my computer as the directory containing test2.html has a js subdirectory containing the two JavaScript files.
Your comment suggests to me that you didn't upload the js subdirectory with its JavaScript files to the ccgi server - is that the problem?
Also the second <script> line has a misplaced closing angle bracket (>). it should read
<script src="/Test2/js/test2.js"></script>
… or was that a typo?
For path definition, either
<script src="/Test2/js/jquery.js"></script>
<script src="/Test2/js/test2.js"></script>
or
<script src="js/jquery.js"></script>
<script src="js/test2.js"></script>
can be used (assuming Test2 is a directory in your ccgi root directory). I prefer the latter if the application is self-contained since it makes relocating easier.
David
Note: Be careful with capital letters on ccgi, case is significant here.
David
Message 2 of 3
(228 Views)
Re: Correct path for external JavaScript files?
26-04-2013 3:42 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks, David -- I should have been able to see that!
With that correction test2.html now works.
But ... my big HTML/JS still doesn't work, I shall have to crawl over it forwards and then backwards...
Thanks for pointing out my error -- at least, now, I know where to look...
Chris
With that correction test2.html now works.
But ... my big HTML/JS still doesn't work, I shall have to crawl over it forwards and then backwards...
Thanks for pointing out my error -- at least, now, I know where to look...
Chris
Message 3 of 3
(228 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Correct path for external JavaScript files?