我创建一个网页,搜索所有的客户信息... 我也使用JSON用于与数据表中的数据自动完成文本框...文本框的TextChanged事件中铬不火
<script type="text/javascript">
$(document).ready(function() {
$("#<%=txtSearch.ClientID %>").autocomplete({
source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/Service.asmx/GetCustomers") %>',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
},
select: function (e, i) {
$("#<%=hfCustomerId.ClientID %>").val(i.item.val);
},
minLength: 1
});
});
我想对TextChanged事件文本框中选定名称的显示数据, 他们textbgox的设置看起来like..`
<asp:TextBox ID="txtSearch" runat="server" AutoPostBack="True"
ontextchanged="txtSearch_TextChanged"></asp:TextBox>
这textchenged事件触发正常在Mozilla,但在Chrome不工作,, 任何人都可以提出一些解决办法....
“真”? –
AutoPostBack =“True”用于触发任何服务器控件的事件 –
删除AutoPostBack =“True”,如果您不使用然后尝试使用chrome。 –