ITPub博客

首页 > 应用开发 > > Jquery autocomplete使用URL方式出错

Jquery autocomplete使用URL方式出错

作者:netroop 时间:2019-08-13 15:41:55 0 删除 编辑
$("#CustomerName").autocomplete({             
            //source: "/Test/Project/GetCompanySelectJson",
            source: [{ "label": "江苏灯为有限公司", "value": 2 }, { "label": "城中投资发展有限公司", "value": 4 }, { "label": "国啦为要", "value": 5 }],
            select: function (event, ui) {               
                $("#CustomerName").val(ui.item.label);
                $("#CustomerId").val(ui.item.value);                
                event.preventDefault();
            }
        });

使用上面的Source,autocomplete会索引出全部记录,而不是按输入的关键字,通过F12查看获得的数据,就是下面的Source值,换成下面的Source是正常使用,也就是说代码应该是没有问题的,为什么上面的Source就索引全部呢?


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4741/viewspace-3130300/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-25

  • 博文量
    152
  • 访问量
    1068