-1

I'm making a table for my course, but the fancy table from datatables won't load, i'm just getting a boring old html table.

I've looked the code over in my book, it seems to be identical. Still im getting an error Failed to load resource: net::ERR_FILE_NOT_FOUND

I don't know what is going wrong. Here is the code

<!DOCTYPE html>
<html>
<head>   
    <link rel="stylesheet" href="C:\Users\bas_t\OneDrive\Code Educom\JQuery\JQuery\style.css"/>
    <link rel="stylesheet" href="//cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"/>
    <script src="js/jquery.js" />
    <script src="//cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"/>

    <script>
      $(document).ready( function() {
        $('#theBeatles').DataTable();
      })   
    </script>
</head>
  
  <body>
    
     <table id="theBeatles" 
            class="display nowrap dataTable dtr-inline collapsed">
        <thead>
            <th>Name</th>
            <th>Email</th>
            <th>Instrument</th>
        </thead>
        <tbody>
            <tr>
                <td>John Lennon</td>
                <td>john@thebeatles.co.uk</td>
                <td>Guitar</td>
            </tr>
            <!-- and so on with the other members --> 
        </tbody>
        </table>
        </body>
        </html>
Basje313
  • 29
  • 5

1 Answers1

-1

You have invalid html and the file path for the CSS may not work

Do these things

  1. Remove the self closing script tags and convert to <script> your file </script> - Why?
  2. You are trying to load a local css file - this may not work effectively, try serving it from a local server - may i suggest serve OR Paste the value of the CSS file into a <style> tag

Best of luck!

Ramakay
  • 2,919
  • 1
  • 5
  • 21