【发布时间】:2015-07-26 00:34:34
【问题描述】:
我正在创建一个搜索所有客户详细信息的页面... 我也在使用 json 来自动完成文本框,其中包含数据表的数据...
<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 设置看起来像..`
<asp:TextBox ID="txtSearch" runat="server" AutoPostBack="True"
ontextchanged="txtSearch_TextChanged"></asp:TextBox>
那个 textchenged 事件在 mozilla 中正确触发,但在 chrome 中不起作用,, 任何人都可以提出一些解决方案....
【问题讨论】:
-
你为什么使用 AutoPostBack="True" ?
-
AutoPostBack="True" 用于触发任何服务器控件的事件
-
删除 AutoPostBack="True" 如果你不使用,然后在 chrome 上尝试。
-
如果我删除了 mozilla 不支持 textchanged 事件
-
请尝试我会工作的。
标签: javascript c# asp.net google-chrome