I need to add two scripts in my project:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="src/assets/noty/jquery.noty.min.js"></script>
First script locales in Internet, his added right. However other js-file stores locally (path src/assets/noty) Plugging in script from Internet Plugging in locally script
But the browser try to plug in my second script from global URL. There is no such file of cause => script wasn't plug in.
May be I specify incorrect path? May be exist key-word, that specifies on locally file
CodePudding user response:
This address src/assets/noty/jquery.noty.min.js
will be accessed from the client's computer. You should let this file be available publicly on your server.
Also, you are using a relative path. It means that if I'm at https://yoursite.com/about/
this address beginning with src/...
will be appended at the end of the current URL, so this js file should be available at https://yoursite.com/about/src/assets/noty/jquery.noty.min.js
to avoid this you can use a /
at the beginning, this slash means the root of your URL, it means that even if you are at https://yoursite.com/about/
the /about/
path will be ignored and the js file will be always at https://yoursite.com/src/assets/noty/jquery.noty.min.js
no matter your current address.
CodePudding user response:
You just have to make sure the path you included is correct, in the case of the image you shared, if the src/
directory is in the http://localhost:3000/src/
path, you can include your script non-relatively this way:
<script src="/src/assets/noty/jquery.noty.min.js"></script>