我习惯于 MVC2 。 您只是将您的脚本和源头链接添加到视图中, 并拨打jquery 函数和 viola... 您有正在使用的 Jquery 代码 。 但我无法使我的 jqGrid 表格 ToGrid 函数工作 。 我猜是因为我根本没有把 jquery 库装进去, 或者我没有在正确的地方运行脚本 。 您可以看一下我的代码, 看看有什么可能出错吗?
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>ShowAllEncounters</title>
<link href="@Url.Content("~/Content/jquery.jqGrid/ui.jqgrid.css")" rel="Stylesheet" type="text/css"/>
</head>
This would be the head... I previously had my scripts linked in there as well... But that didn t work... So I put outside of the tag... like so...
</html>
<script src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")" type="text/javascript"/>
<script type="text/javascript">
$(document).ready(function () {
...});
我在MVC4站点怎么写剧本?
我甚至不能得到一个可怕的警报 出现!!!!!!!!!
@model IEnumerable<FocusedReadMissionsRedux.Models.TemplateModel>
<!DOCTYPE html>
<html>
<head>
<script src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")" type="text/javascript"/>
<link href="@Url.Content("~/Content/jquery.jqGrid/ui.jqgrid.css")" rel="Stylesheet" type="text/css"/>
<script type="text/javascript">
$(document).ready(function () {
alert("what is going on");
});
</script>
<title>ShowAllEncounters</title>
</head>
更新: 似乎我对何时加载 jquery 库有疑问。 这肯定是个问题。 我需要一个坚实的图案模式, 才能把这些脚本添加到工程中?