Php 剑道自动完成问题

Php 剑道自动完成问题,php,kendo-ui,Php,Kendo Ui,我正在处理剑道自动完成。但它不能正常工作。我不明白问题出在哪里。这是我的密码。请帮我解决这个问题 $("#autocomplete").kendoAutoComplete({ minLength : 1, dataSource: new kendo.data.DataSource({ serverFiltering: true, dataType: "json", transport: { rea

我正在处理剑道自动完成。但它不能正常工作。我不明白问题出在哪里。这是我的密码。请帮我解决这个问题

$("#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). "}";
?>

参数map
传输
的对象,而不是来自
读取
,文档

应该是:

$("#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"
});