0
나는 검도 자동 완성을 다루고있다. 그러나 제대로 작동하지 않습니다. 나는 그 문제가 무엇인지 이해하지 못한다. 여기 내 코드가있다. 이 문제를 해결하기 위해 나를 도와주세요.검도 자동 완성 문제
$("#autocomplete").kendoAutoComplete({
minLength : 1,
dataSource: new kendo.data.DataSource({
serverFiltering: true,
dataType: "json",
transport: {
read: {
url: "data/emp_det.php",
parameterMap: function(options, operation) {
return {
StartsWith: options.filter.filters[0].value
}
}
},
},
schema: {
data: "data"
},
}),
dataTextField: "user_name",
});
})(jQuery, kendo);
내 PHP 파일은
<?php
$db = new PDO('mysql:host=localhost;dbname=abc', 'root', '');
$arr = array();
$stmt = $db->prepare("SELECT id, user_name FROM employee WHERE user_name LIKE ?");
if ($stmt->execute(array($_GET["StartsWith"]. "%"))) {
while ($row = $stmt->fetch()) {
$arr[] = $row;
}
}
header("Content-type: application/json");
echo "{\"data\":" .json_encode($arr). "}";
?>