能否请你帮我如何从自动完成下拉JQuery的自动完成下拉菜单选择功能
下面就请选择一个项目的火javascript函数txtID()是段
$("Autotxt").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Webservice.asmx/GetNames",
data: "{'prefixText':'" + request.term + "'}",
dataType: "json",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('|')[0],
val: item.split('|')[1]
}
}))
},
error: function (result) {
alert("Due to unexpected errors we were unable to load data");
},
failure: function (response) {
alert("Due to unexpected errors we were unable to load data");
}
}).result(function (event, ui) {
txtID(ui.item.val);
});
},
minLength: 2
});
function txtID(val)
{
alert(val)
}
任何帮助将是非常感激。 谢谢
它是什么,你想达到什么目的?在建议菜单中选择了某些内容时是否提示? – 2012-02-09 09:41:34