var projects2 = <?php include_once "AutoCompleteHandler.php"; ?>;
var projects23= <?php include_once "AutoCompleteHandler.php"; ?>;
$("#p_name").autocomplete({
minLength: 2,
source: projects2,
focus: function(event, ui) {
$("#p_name").val(ui.item.label);
return false;
},
select: function(event, ui) {
return false;
}
})
.data("ui-autocomplete")._renderItem = function(ul, item) {
return $("<li>")
.append("<a>" + item.label + "/" + item.p_gender + "/" + item.p_age + "</a>")
.appendTo(ul);
};
$("#p_tp").autocomplete({
minLength: 2,
source: projects23,
focus: function(event, ui) {
$("#p_tp").val(ui.item.label);
return false;
},
select: function(event, ui) {
return false;
}
})
.data("ui-autocomplete")._renderItem = function(ul, item) {
return $("<li>")
.append("<a>" + item.label + "/" + item.p_gender + "/" + item.p_age + "</a>")
.appendTo(ul);
};
}
我使用上面的代码段用数据填充我的两个文本字段(自动完成)。但是当我尝试这个时,得到以下错误.project2和项目23从php文件中收到名为 AutoCompleteHandler.php的json数据
Uncaught SyntaxError: Unexpected token ;
这是我的json输出
[
{
label: "kasun" ,
p_nic: "880020110v",
p_age: "02-01-1988" ,
p_gender: "Male"
}
]