我的看法如下:
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
@using (Ajax.BeginForm(new AjaxOptions { HttpMethod = "Get", InsertionMode = InsertionMode.Replace, UpdateTargetId = "DisplayPatients" }))
{
<input type="search" name="searchTerm" />
<input type="submit" value="Do Search" />
}
每当我尝试编译并查看我得到的 html 页面的源代码时,我看到,
<form action="/" data-ajax="true" data-ajax-method="Get" data-ajax-mode="replace" data-ajax-update="#DisplayPatients" id="form0"
method="post">
但是,在我的 Ajax.BeginForm 中,我指定了HttpMethod = Get
. 尽管如此,我还是method = "post"
在输出 html 页面中得到了。
任何想法为什么?提前致谢。
编辑:
view-source
我什至在浏览器中检查了我的页面源。由此可见:
<script src="/Scripts/jquery.unobtrusive-ajax.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js" type="text/javascript"></script>
<form action="/" data-ajax="true" data-ajax-method="Get" data-ajax-mode="replace" data-ajax-update="#DisplayPatients" id="form0" method="post"> <input type="search" name="searchTerm" />
(请注意,脚本(jquery-unobtrusive)实际上是存在的)