douxu0550 2013-09-11 06:50
浏览 65

JQuery UI自动完成错误:未捕获TypeError:无法读取null的属性“label”

when I start typing product names into the textbox I get the following error in my console output:

Uncaught TypeError: Cannot read property 'label' of null jquery-ui.js:45
a.extend.filter jquery-ui.js:45
e.extend.grep jquery.js:2
a.extend.filter jquery-ui.js:45
a.widget._initSource.a.isArray.source jquery-ui.js:45
a.widget._search jquery-ui.js:45
a.widget.search jquery-ui.js:45
(anonymous function)

Javascript

<script type="text/javascript">
 $('document').ready(function() {

    var products = <?php echo json_encode($products_arr); ?>;

    console.log(products); //products are displayed ok
   $("#product").autocomplete({
      source: products
   });
 });
</script>

My jquery works as I've tried the example in the the jquery docs.

I stepped through my products array limiting my sql results to 10 results at a time and it began to work until i got to 66. In the JS console output it shows me a null entry.

.."PN", null, "SS"]

I did remove all empty/null values which appears to fix it but can someone tell me why this might happen? I don't have any empty records in the DB.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败
    • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
    • ¥15 找一位技术过硬的游戏pj程序员
    • ¥15 matlab生成电测深三层曲线模型代码
    • ¥50 随机森林与房贷信用风险模型