Jquery $()自动完成不是一个函数
下面是我要呈现的代码。我搜索了一下,发现jquery的顺序可能有错误。我改变了它作为给予,但仍然不是我的工作Jquery $()自动完成不是一个函数,jquery,asp.net-mvc,autocomplete,Jquery,Asp.net Mvc,Autocomplete,下面是我要呈现的代码。我搜索了一下,发现jquery的顺序可能有错误。我改变了它作为给予,但仍然不是我的工作 @model IEnumerable<UserManagementSystem.Models.UserDetail> @using System.Linq @{ ViewBag.Title = "Index"; } <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness
@model IEnumerable<UserManagementSystem.Models.UserDetail>
@using System.Linq
@{
ViewBag.Title = "Index";
}
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function () {
jQuery("#SearchName").autocomplete({
source: function (request, response) {
$.ajax({
url: "/Home/Index",
type: "POST",
dataType: "json",
data: { Prefix: request.term },
success: function (data) {
response($.map(data, function (item) {
return { label: item.Name, value: item.Name };
}))
}
})
},
messages: {
noResults: "", results: ""
}
});
})
</script>
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p><br /><p>
@using (Html.BeginForm("Index", "Users", FormMethod.Get))
{
@Html.TextBox("SearchName", "", new { @class = "control-label col-md-2", Style = "margin-right:10px;", placeholder = "Name" })
@Html.TextBox("SearchEmail", "", new { @class = "control-label col-md-2", Style = "margin-right:10px;", placeholder = "Email" })
@Html.DropDownList("SearchDesignation", ViewBag.DesignationList as SelectList, "Select", new { @class = "control-label col-md-2", Style = "margin-right:10px;" }) <input type="submit" value="Search" onclick="location.href='@Url.Action("Index", "Users")'" />
}
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Contact)
</th>
<th>
@Html.DisplayNameFor(model => model.Email)
</th>
<th>
@Html.DisplayNameFor(model => model.Designation)
</th>
<th>
@Html.DisplayNameFor(model => model.Department)
</th>
<th>
@Html.DisplayNameFor(model => model.Address)
</th>
<th></th>
</tr>
@if (!Model.Any())
{
<tr><td></td><td></td><td></td><td>No Record Found</td><td></td><td></td><td></td></tr>
}
else
{
foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Contact)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td>
@Html.DisplayFor(modelItem => item.Designation)
</td>
<td>
@Html.DisplayFor(modelItem => item.Department)
</td>
<td>
@Html.DisplayFor(modelItem => item.Address)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
@Html.ActionLink("Details", "Details", new { id = item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.ID }, new { onclick = "return confirm('Are you sure you wish to delete this?');" })
</td>
</tr>
}
}
</table>
@model IEnumerable
@使用System.Linq
@{
ViewBag.Title=“Index”;
}
$(文档).ready(函数(){
jQuery(“#SearchName”).autocomplete({
来源:功能(请求、响应){
$.ajax({
url:“/Home/Index”,
类型:“POST”,
数据类型:“json”,
数据:{前缀:request.term},
成功:功能(数据){
响应($.map)(数据、功能(项){
返回{label:item.Name,value:item.Name};
}))
}
})
},
信息:{
否结果:“”,结果:“”
}
});
})
指数
@ActionLink(“新建”、“创建”)
@使用(Html.BeginForm(“Index”,“Users”,FormMethod.Get))
{
@TextBox(“SearchName”,new{@class=“control label col-md-2”,Style=“margin right:10px;”,placeholder=“Name”})
@TextBox(“SearchEmail”,new{@class=“control label col-md-2”,Style=“margin right:10px;”,placeholder=“Email”})
@Html.DropDownList(“SearchDesignation”,ViewBag.DesignationList作为SelectList,“Select”,新的{@class=“控制标签col-md-2”,Style=“margin right:10px;”)
}
@DisplayNameFor(model=>model.Name)
@DisplayNameFor(model=>model.Contact)
@DisplayNameFor(model=>model.Email)
@DisplayNameFor(model=>model.Designation)
@DisplayNameFor(model=>model.Department)
@DisplayNameFor(model=>model.Address)
@如果(!Model.Any())
{
没有找到任何记录
}
其他的
{
foreach(模型中的var项目)
{
@DisplayFor(modelItem=>item.Name)
@DisplayFor(modelItem=>item.Contact)
@DisplayFor(modelItem=>item.Email)
@DisplayFor(modelItem=>item.Designation)
@DisplayFor(modelItem=>item.Department)
@DisplayFor(modelItem=>item.Address)
@ActionLink(“编辑”,“编辑”,新的{id=item.id})|
@ActionLink(“详细信息”,“详细信息”,新的{id=item.id})|
@ActionLink(“Delete”,“Delete”,new{id=item.id},new{onclick=“return confirm('您确定要删除这个吗?');”)
}
}
以上所有代码都是在MVC4.5.2中完成的,是否存在与.Net framework相关的问题?。我被困在这里,不知道现在该怎么办。我还附上调试器错误图像。检查控制台是否存在错误的可能副本,我打赌这将解释问题。
jquery-1.10.2.js
和jquery-1.10.2.min.js
,使用单个jQuery引用。我如何才能发现存在重复?您阅读了您编写的代码:)有两个连续的行使用相同的脚本,一个最小化了一个,但最后是相同的脚本。可能的重复检查您的控制台是否有错误,我打赌这会解释问题。jquery-1.10.2.js
和jquery-1.10.2.min.js
,使用一个jquery引用。我怎么能发现有重复?你读了你写的代码:)有两个连续的行使用相同的脚本,一个最小化,但最后是相同的脚本。