请帮助我使用Bootstrap typeahead解决此错误。

这是我用来调用源代码的php代码。

    function getUser() {

    $sth = mysql_query("SELECT id,contact FROM cinfo ORDER BY id ASC");
    $rows = array();
    while ($r = mysql_fetch_assoc($sth)) {
        $rows[] = $r;
    }
    print json_encode($rows);
}


这是我的javascript文件

更新2 JS

        $('.user').typeahead({
    source : function(typeahead, query) {
        return $.post('/ticket/getUser', {
            query : query,
        }, function(data) {
            return typeahead.process(data);
        })
    },
    property : 'contact'
});


我得到以下错误,现在产生https://gist.github.com/1866577#gistcomment-263183

我正在使用以下引导程序提前输入脚本https://gist.github.com/1866577

谢谢。

最佳答案

冒着冒出我自己的号角的风险,如果您在使Gist正常工作时遇到困难,可以尝试使用我的完整typeahead扩展程序,该扩展程序具有所需的功能,并受文档和演示的支持。

https://github.com/tcrosen/twitter-bootstrap-typeahead

关于php - bootstrap 提前输入错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11346251/

10-10 11:58
查看更多