Lunarpages Web Hosting Forum

Author Topic: Adding jquery  (Read 150 times)

Offline johnbe3

  • Newbie
  • *
  • Posts: 3
Adding jquery
« on: November 02, 2018, 05:56:29 AM »
I am converting my old frontpage website to bootstrap.  I've just copied my first version that is working fine on my local host to the server and some of the javasript is not working.  Since the code works on my localhost I'm thinking the problem is how the javascript is being accessed by the server.  Am I supposed to configure anything on the server first, or am I supposed to change the directory of the scripts or something?  Below is how I have the scripts in my html page.  Thank You.

<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script src="js/lightbox-plus-jquery.min.js"></script>

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6360
Re: Adding jquery
« Reply #1 on: November 02, 2018, 10:37:39 AM »
Your code, as stands, expects certain Boostrap-related files to be in certain places. For example, bootstrap.min.js is to be in the js/ directory under wherever your page is. Have you copied all the Bootstrap JS and CSS files to your site? Most people prefer to put in the full path to some server (such as maxcdn) and let someone else worry about storing the files.
Visit My Site

E-mail Me
-= From the ashes shall rise a sooty tern =-

Offline johnbe3

  • Newbie
  • *
  • Posts: 3
Re: Adding jquery
« Reply #2 on: November 02, 2018, 10:58:51 AM »
Yes,  I have the javascript files on the server in a js\ directory.  It mirrors the file structure as I have on the localhost.  All the CSS files are being found and they are set up the same way.

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6360
Re: Adding jquery
« Reply #3 on: November 02, 2018, 02:22:18 PM »
Then it should work, unless you have something in an .htaccess file that's sending js/ or .js to the wrong place, or implementing compression that your browser can't handle.

The JS and CSS are run client-side (on the browser), so nothing else that your server does should affect those files, unless they're not getting to the client in the first place. Is this a Linux/Apache server, or Windows? See if your browser has developers tools to monitor network traffic -- maybe you can confirm that your files are getting over.

Do you have evidence that some or all JS files are not making it over? Can you examine the browser cache? Also try clearing the cache just to make sure it receives a fresh copy of everything.
Visit My Site

E-mail Me
-= From the ashes shall rise a sooty tern =-

Offline johnbe3

  • Newbie
  • *
  • Posts: 3
Re: Adding jquery
« Reply #4 on: November 06, 2018, 06:28:23 AM »
Yes,  there must have been a missing CSS or JS file on the server.  I refreshed those directories from my local server and everything is working now.  Thanks for your help.