【发布时间】:2012-09-10 14:32:06
【问题描述】:
可能重复:
jquery autocomplete this.source is not a function error
我有一个自动完成功能,我想将它连接到我的 API 以返回所有客户帐号。问题是我的 API 返回一个对象:AccountNumber、InvoiceNumber、Name、Address 等。当我尝试将我的来源设为 AccountNumber 时,如下所示:
$.getJSON('/api/Customers', function(data) {
$("#AccountNumber").autocomplete({
source: data.AccountNumber,
minLength: 4
});
});
我得到了这个错误:
Uncaught TypeError: Property 'source' of object #<Object> is not a function
任何想法我在这里做错了什么?
【问题讨论】: