日期:2014-05-16  浏览次数:20408 次

jquery autocomplate

$.ajax({
                type: "POST",
                url: "AutoComplateHandler.ashx",
                success: function (data, status) {
                    if (status == "success") {
                        var source = [
                            { "Name": "Java", "Age": 22 },
                            { "Name": "C++", "Age": 232 },
                            { "Name": "PHP", "Age": 233 },
                            { "Name": "Python", "Age": 231 },
                            { "Name": "Perl", "Age": 230 },
                            { "Name": "Asp", "Age": 213 },
                            { "Name": "C++", "Age": 23 }
                            ];
                        $("#txtComplate").autocomplete({
                            source: source, //["Java","C++","PHP","Python"] 
//如何提取json Name集合
                            select: function (event, ui) {
                                alert(ui.item.value);//获取当期选择的value 如何根据当期选中Name
//属性(如:Java)的值获取相对应的Age值
                            }
                        });
            &nb