0
동적으로 ASP.NET MVC 3보기를로드하고 있습니다. 보기 내부에는 "자동 완성"이 필요한 텍스트 상자가 있습니다. 아래 코드 :ASP.NET MVC에서 jQuery 자동 완성 기능이 작동하지 않습니다. 동적으로로드 됨보기
@model CountryViewModel
@using (Html.BeginForm("Create", "Country", FormMethod.Post)) {
@Html.ValidationSummary(true)
<div class="field">
@Html.LabelFor(model => model.Name)
@Html.TextBoxFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div class="field">
@Html.LabelFor(model => model.Description)
@Html.TextBoxFor(model => model.Description)
</div>
<div class="field">
@Html.LabelFor(model => model.Latitude)
@Html.TextBoxFor(model => model.Latitude)
</div>
<div class="field">
@Html.LabelFor(model => model.Longitude)
@Html.TextBoxFor(model => model.Longitude)
</div>
@Html.HiddenFor(model => model.CultureId, new { id = "CultureId" })
}
<script type="text/javascript">
$(document).ready(function() {
$('#Name').autocomplete({
source: function(request, response) {
$.ajax({
url: '@(Url.Action("GetCountriesB", "Country"))',
data: "{ 'countryName': '" + request.term + "' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function(data) { return data; },
success: function(data) {
response($.map(data.d, function(item) {
return {
value: item.Country
}
}))
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
minLength: 2,
focus: function(event, ui) {
$('#Name').val(ui.item.Country);
return false;
}
});
});
는 내가 jQuery를 UI 대화 상자 안쪽이보기를로드하고 있습니다. Firebug를 사용하여 디버깅 할 때 "스크립트"태그가로드되지 않은 것 같습니다. 따라서 자동 완성 기능이 작동하지 않습니다.
이유는 무엇입니까?
감사합니다.
코드에 '
나는 동일한 문제가 있었고 z- 색인이 너무 낮게 나타났다. 그것은 실제로 일하고 있었지만, 단지 보여주지 않았습니다.
출처
2016-08-04 10:18:31