I want add jQuery DataTable (http://www.datatables.net/) to my mvc4 site. But it's doesn't work. Doesn't show anything, table look like before adding script.
FireBug show an error:
TypeError: $(...).dataTable is not a function
**Admin_panel.cshtml**
@model IEnumerable<Rejestracja_imprez.Models.User>
@{
Layout = "~/Views/Shared/_PanelAdmin.cshtml";
ViewBag.Title = "Admin";
}
<script src="~/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.dataTables.js" type="text/javascript"></script>
<link href="~/Content/themes/base/jquery.dataTables.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
$(document).ready(function () {
$('#myDataTable').dataTable();
});
</script>
<table id="myDataTable">
....
In html page it's work good.
<html>
<head>
<style type="text/css" title="currentStyle">
@import "../../media/css/jquery.dataTables.css";
</style>
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable();
} );
</script>
</head>
<body >
<table id="example" >
...
TypeError: $(...).dataTable is not a functiondataTableon the jQuery object. Did the JavaScript file for that plugin get loaded? Did the JavaScript file for jQuery get loaded? (Probably, if it got to that function call.) Are there version conflicts between the two? Is that the correct usage of the plugin? You need to debug this in your browser. If you can show a live example of the problem we might be able to help identify what's wrong.dataTable. I make a simple html page using this jQuery and it is working good. I update main post with html page where it's work good.