我想将 jQuery DataTable ( http://www.datatables.net/ ) 添加到我的 mvc4 站点。但它不起作用。不显示任何内容,表格看起来像添加脚本之前的样子。
FireBug 显示错误:
TypeError: $(...).dataTable 不是函数
**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">
....
在 html 页面中,它工作得很好。
<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" >
...