我有以下格式的json。幫助JQuery自動完成
[{"tag":{"name":"& Awards","id":142}},{"tag":{"name":"& Bisexual Bars","id":207}},{"tag":{"name":"& Clubs","id":40}},{"tag":{"name":"& Imaging","id":1188}}}
和我用下面的代碼
$("#tags_name").autocomplete({
source: "/companies/autocomplete_tags2.json",
width: 320,
dataType: 'json',
highlight: false,
scroll: true,
scrollHeight: 300,
parse: function(data) {
var array = new Array();
for(var i=0; i < data.tag.length; i++){
array[i] = {data: data.tag[i], value: data.tag[i].value, result: data.tag[i].id };
}
return array;
}
});
當網頁加載完畢後我得到的錯誤是「newUncaught語法錯誤:輸入意外結束」
我失去的是什麼?
哪條線拋出了錯誤? – Dogbert