Jump to content

How come some javascript files won't work externally?


man5

Recommended Posts

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.

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)).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.