当我输入任何用户名时,它显示上面的错误。但是当我们在firefox和Internet Explorer中打开它时,它工作正常。以下是我的代码
function GetActiveEmployeeNames() {
//debugger;
$.ajax({
type: "POST",
url: "VerveWall.aspx/GetActiveEmployeeNames",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
OnSucceeded(response.d, null, null);
},
failure: function (response) {
//alert(response);
}
});
}
调用以下函数
var source = [];
function OnSucceeded(result, userContext, methodName) {
//debugger;
//source = "";
if (result.length > 0) {
if (source.length < 1) {
for (var i = 0; i <= result.length - 1; i++) {
source.push({
"empId": result[i].Id,
"employeeName": result[i].Employee_Name,
"firstName": result[i].FirstName,
"middleName": result[i].MiddleName,
"lastName": result[i].LastName,
"photographFileName": result[i].PhotographFileName
});
}
}
}
bindPost();
}
并调用bindPost函数
function bindPost() {
//debugger;
var highlight_users = new Array();
$("#<%=txtPostMessage.ClientID%>").kendoAutoComplete({
separator: " ",
filter: "contains",
dataTextField: "employeeName",
dataSource: source,
minLength: 3,
placeholder: "What's on your mind...",
template: '<img src="upload/Photograph/${data.photographFileName}" width=30 height=30/> ${data.employeeName}',
height: 370,
select: function (data) {
tagging_users.push(data.empId);
highlight_users.push(data.firstName);
highlight_users.push(data.lastName);
$("#<%=txtPostMessage.ClientID%>").highlightTextarea('enable');
jQuery("#<%=txtPostMessage.ClientID%>").highlightTextarea({
words: highlight_users,
color: "#aacccc"
});
}
}).data("kendoAutoComplete");
}