Data table not working properly

Data table not working properly

ainaz_amaainaz_ama Posts: 1Questions: 0Answers: 0

Dear Team,

I have problem with data table, I just want to load the data table with data and show it in my page but sometimes it loads the files and shows data table properly as it should but sometimes it is just a list instead of a data table. I also set <sessionState cookieless="false" /> in Web.config file.

The errors are like ;

jquery-1.11.3.min.js:1 Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
ListBrand:214 Uncaught ReferenceError: $ is not defined

my code is as follows:

@model IEnumerable<WebAppACTExcel.Brand>

<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<script src="https://code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js" defer type="text/javascript"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css" />

<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.4/js/dataTables.buttons.min.js" defer></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.flash.min.js" defer></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js" defer></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js" defer></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js" defer></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.html5.min.js" defer></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.print.min.js" defer></script>

</head>

@{
ViewBag.Title = "ListBrand";
}

<body>
<h2>ListBrand</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="display" id="myTable">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.BrandName)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.BrandName)
                </td>
                <td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.BrandId }) |
                    @Html.ActionLink("Details", "Details", new { id = item.BrandId }) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.BrandId })
                </td>
            </tr>
        }
    </tbody>

</table>

</body>

</html>

$(document).ready(function () { $('#myTable').dataTable( { dom: 'Bfrtip', buttons: [ 'copy', 'csv', 'excel', 'pdf', 'print' ] }); });

Would yo please help me with this problem?

This discussion has been closed.