0

I have that error on my php file. I have check my libraries order but i think is correct. This is my script code:

< script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.0.min.js"></script>

<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js">
</script>

<script>    

    $(document).ready(function() {
        $('#tablaLocalizaciones').dataTable({

            "ajax": "tabla.php",
                "columns":[
                { "data":"nombre"},
                { "data":"tipo"},


                ]



        });

    } );

</script>

any ideas? Thanks

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
M.Gea
  • 27
  • 1
  • 1
  • 8
  • Look at your URLs. The first is loading according to the page's default scheme, which is probably HTTP. The second is using HTTPS. If this is the case, the browser will reject the second script because you can't mix secure and insecure content. – Xavier J May 17 '16 at 18:28
  • If the site is indeed loaded over http I don't see the problem @codenoire? – PeeHaa May 17 '16 at 18:29
  • @OP just remove the space in your html script element... – PeeHaa May 17 '16 at 18:31
  • If the site is loaded over HTTP, then modern browsers won't load the scripts over HTTPS. Conversely, if the site is loaded over HTTPS, they won't load scripts over HTTP. Read more here. https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content?hl=en – Xavier J May 17 '16 at 18:32
  • That doesn't make any sense @codenoire. Only the last part is true. – PeeHaa May 17 '16 at 18:33
  • I changed it - had a typo. – Xavier J May 17 '16 at 18:33
  • @codenoire, if you are on http:// you can load https:// resources, you can not do the inverse – Patrick Evans May 17 '16 at 18:33
  • Of course browsers will load ssl resources from non ssl pages. – PeeHaa May 17 '16 at 18:33
  • The problemas was that i had multiples references to Jquery :) problem fixed! – M.Gea May 18 '16 at 17:28

1 Answers1

1

You need to load jQuery before you load any jQuery-related code such as jQuery DataTables, see below:

<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.dataTables.js" type="text/javascript"></script>

Also, for production version it's recommended to load minified version (ending with .min.js instead). You can see it here

Community
  • 1
  • 1
hemnath mouli
  • 2,617
  • 2
  • 17
  • 35