In the snippet below, how can I get the jquery autocomplete plugin to:
- Update a hidden field with the UserID
- Update '#MessageTo' with the full name
I believe I need to use .result, but I can't figure out the syntax. Please note that I'm using ASMX so I must do a post (don't want to enable security risk)
$("#MessageTo").autocomplete({
dataType: "json",
autoFocus: true,
minLength: 3,
source: function (request, response) {
var postParams = "{ pattern: '" + $("#MessageTo").val() + "' }";
return jQuery_1_7_1.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '/Services/Users.asmx/GetNames',
data: postParams,
dataType: "json",
success: function (data) {
response($.map(data.d.Users, function (c) {
return {
label: c.FullName,
value: c.UserID
};
}));
}
});
}
});
I see some similar posts but not in conjunction with ASMX.
d
property fordata.d
? – Og