Jquery does not load to localhost

Asked

Viewed 1,736 times

-1

inserir a descrição da imagem aqui

The code is there, the link to the jquery file is correct, however it is not loading the same

  • 1

    tries to swap http for https. And the latter includes it.

  • 2

    Always include jquery before, after plugins etc..

  • @Dontvotemedown has it too.

  • By the image you can see that the console is full of errors.

2 answers

0


Call it using http or https like this:

<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>

Or download it locally and make the local reference.

Use these references before other javascript references.

Source: https://jquery.com/download/

0

When you do not specify the protocol in this way: "//dominio.com/code.js" the browser complete with the protocol of your page. If you are on http://localhost/ he’s gonna get the http, if you are https://localhost it will complete with https and this sometimes causes some problem.

Another problem is that the main jquery library should always come before its derivatives, example:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery-migrate.js"></script>
<script type="text/javascript" src="jquery-bxslider.js"></script>

This is because the jQuery code needs to be "set" so that other libraries can access it. If it is "set" after libraries, all of their functions using jQuery will fail.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.