我正在使用自动完成框来搜索州名目的。但是我收到了以下错误。
Microsoft JScript runtime error: Object doesn't support property or method 'autocomplete
我应该为此需要什么所有脚本。请在下面找到我的代码:
$(function () {
$('#txtBState').autocomplete({
source: function (request, response) {
if (request.term in cache) {
response($.map(cache[request.term].d, function (item)
{ return { value: item.State, value: item.ChargeID, value: item.ShippingCharge} }))
}
$.ajax({
url: "../Billing/AutocompleteState",
dataType: "json",
data: {
SearchText: $('#txtBState').val(),
SearchText: request.term
},
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) {
response(data.slice(0, 5));
}
});
},
minLength: 2,
select: AutoCompleteSelectHandlerState
});
function AutoCompleteSelectHandlerState(event, ui) {
var selectedObj = ui.item;
$('#txtChargeIDs').val(ui.item.ChargeID);
$('#txtChargeAmts').val(ui.item.ShippingCharge);
}
});
我在视图中使用了三种类型的脚本
不支持所有三种格式的脚本。
1)<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/main.css"type="text/css" />
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css" type="text/css" />
2)
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js" type="text/javascript"></script>
3)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />