man5 Posted March 6, 2014 Share Posted March 6, 2014 Say on an Html page, I have a a js file like this. <html> <head> <script type="text/javascript" src="fileName.js"></script> </head> </html> Well it's an ajax file to be exact. The problem with above is that the code won't run from the file path. If I put the code right on the html page below, it'll work. Doing it like this is very messy if I have many scripts running. <html> <head> <script type="text/javascript" src="fileName.js"> ajax code here... </script> </head> </html> Can anyone tell me what the problem is exactly? And no, this is not an issue with all js files. I suppose it's only the ones with ajax running. Quote Link to comment https://forums.phpfreaks.com/topic/286740-how-come-some-javascript-files-wont-work-externally/ Share on other sites More sharing options...
KevinM1 Posted March 6, 2014 Share Posted March 6, 2014 What do you mean by "not working"? Are you getting any errors? Have you run your code while your browser's developer tools are running? And you should show your code (within our forum's code tags (the <> button in our text editor or by manually typing and placing your code within)). Quote Link to comment https://forums.phpfreaks.com/topic/286740-how-come-some-javascript-files-wont-work-externally/#findComment-1471592 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.