Getting error when creating datatable

Getting error when creating datatable

gib65gib65 Posts: 29Questions: 13Answers: 0

Hello,

I'm trying to create a DataTable and it's giving me issues. First, here is my code:

[code]
<html>
<head>
<link href="JQuery\jquery-ui.css" rel="stylesheet" />
<link href="JQuery\jquery-ui.structure.css" rel="stylesheet" />
<link href="JQuery\jquery-ui.theme.css" rel="stylesheet" />
<script type="text/javascript" src="JQuery\jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="JQuery\jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.css">

</head>
<body>

Column 1 Column 2
Row 1 Data 1 Row 1 Data 2
Row 2 Data 1 Row 2 Data 2
var t = $("#table_1").DataTable();

</body>
</html>
[/code]

Here is the error message I get in the Chrome console:

http://www.shahspace.com/dtexample2/file_not_found.png

Surprisingly, this problem doesn't occur when I move the code to my server:

http://www.shahspace.com/dtexample2/

Can someone please explain why I have this problem on my desktop but not on my server? Thanks.

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Your server version has this:

    <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.js"></script>
    

    which I don't see in your posted code.

  • gib65gib65 Posts: 29Questions: 13Answers: 0

    I had that line in the original post. This forum seems to delete that line if it detects it in posts.

    But in any case, I found that if I prefix the references to cdn.datatables.net with http, it solves the problem.

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    // is protocal relative. So if you used anything other than https:// or http:// to load the host file, then yes, you would need to specify the protocol.

    Allan

This discussion has been closed.