seventheyejosh Posted March 11, 2009 Share Posted March 11, 2009 can some one please, please tell me why <script type="text/javascript" src="/templates/admin/js/toggle.js"></script> will work perfectly fine, but <script type="text/javascript" src="/js/toggle.js"></script> will not work period!????? I am going freaking nuts. And im not a nOOb, i just cant figure it out to save my life! MANY MANY thanks in advance. Quote Link to comment Share on other sites More sharing options...
corbin Posted March 11, 2009 Share Posted March 11, 2009 Uhhh.... Better question, why would that work? /js/ != /templates/admin/js/ Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted March 11, 2009 Author Share Posted March 11, 2009 if i put the file in /templates/admin/js/toggle.js and put in the <script type="text/javascript" src="/templates/admin/js/toggle.js"></script> it works beautifully, but if i put it in /js/toggle.js with <script type="text/javascript" src="/js/toggle.js"></script> it doesnt work. the folders both have the same perms and everything Quote Link to comment Share on other sites More sharing options...
corbin Posted March 11, 2009 Share Posted March 11, 2009 If you try to go to the file directly after doing that, what error is there? Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted March 11, 2009 Author Share Posted March 11, 2009 it starts saying my functions are undefined, etc, as if the file isnt accessible or something. basically i'm dynamically reading the directory of js/ in public_html, and putting all .js files into the header. it works just fine reading from the js folder in the admin template, but not in the js folder public_html/templates/admin/toggle.js = public_html/js/toggle.js = even though both will show up in the page source just fine Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 11, 2009 Share Posted March 11, 2009 corbin was asking what errors do you get if you go to the file directly. I believe he means if you go to the JS file directly, i.e. "www.yourdomain.com/js/toggle.js"? Is the file found by the browser?It should attempt to download it. Could be a caching issue where it has "remembered" the location of the fine and can't find it any more. Try pressing Ctrl-F5 while on the html page. however, I did not ice in your last post you put this: public_html/templates/admin/toggle.js = That's not the same as "/templates/admin/js/toggle.js". Typo? Also, what is the path to the HTML file that is loading the JS file? And, i will admit I have had similar bouts of frustration and found the problem was just a bonehead issue on my part such as I was editing my local copy of the HTML page and had moved the JS file on my live server. Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted March 11, 2009 Author Share Posted March 11, 2009 Yea it was a typo I actually managed to find the error early this morning. In my htaccess, i forgot to add the rule for the folders to make them accessible. I had: RewriteCond %{REQUEST_URI} "/modules/" so /modules/admin/js/toggle.js was accessible but forgot to add RewriteCond %{REQUEST_URI} "/js/" [OR] RewriteCond %{REQUEST_URI} "/includes/" so neither /includes/js/toggle.js or /js/toggle.js were accessible. so i was able to see my scripts up there, but couldnt access them. i actually figured it out when my flv files werent accessible from /includes/video/, but were accessible in /modules/main/video/ thanks for all your help though and sorry to post in the javascript forum, i honestly thought thats what the error was. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.