core 3.1 Consol $(...).DataTable is not a function
core 3.1 Consol $(...).DataTable is not a function
Pixelo
Posts: 9Questions: 3Answers: 0
Hello
I'm want use your datatable in my project .NET Core3.1 MVC but $(...).DataTable is not a function
In my earlier project MVC (2 years earlier) MVC it worked perfectly.
<html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Page - sfp_permit</title>
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/site.css">
<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js"></script>
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" href="/Home">sfp_permit</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<p class="nav navbar-text navbar-right">Hello, SFPZAPA\zgodkad!</p>
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" href="/">Raport uprawnień</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
<div class="text-center">
<select id="UsersList" class="form-control" onchange="changeUser()" name="UserId">
<option value="">Wybierz operatora</option>
</select>
<div id="reportZapaNet"><script type="text/javascript">
$(document).ready(function () {
$('#ReportTableZapaNet').DataTable();
});
</script>
<table id="ReportTableZapaNet" class="display" style="width:100%">
<thead>
<tr>
<th>Nazwa roli w AD</th>
<th>Opis roli w AD</th>
<th>Nazwa uprawnienia</th>
<th>Opis uprawnienia</th>
</tr>
</thead>
<tbody>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
...
</tbody>
</table>
</div>
</div>
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
© 2021 - sfp_permit - <a href="/Home/Privacy">Privacy</a>
</div>
</footer>
<script src="/lib/jquery/dist/jquery.min.js"></script>
<script src="/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="/js/site.js?v=4q1jwFhaPaZgr8WAUSrux6hAuh0XDg9kPS3xIVq36I0"></script>
<script src="/Scripts/IndexReportPermission.js"></script>
</body></html>
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
This discussion has been closed.
Replies
You are loading jQuery twice; one line line 7 and the other in line 81. You will want to load it only once for the page..
Kevin
Thanks
I spent a few hours on it, I forgot that core loads libraries at the end