-1
嗨和谢谢你帮助我,英语不是我的第一语言,提前抱歉。 :)如何使用Symfony3 AJAX和Chosen2自动完成
当选择选择框时,我得到通知“找不到结果”,但是当我在开发人员工具栏中查看结果时,发现我收到了完整的JSON。
如何匹配单个值而不是获取整个JSON?
JSON结果:
["Descent: Journeys in the Dark (Second Edition)","Dominion","Ascension","Star wars LCG","Magic: The
Gathering Duel Decks Anthology"]
脚本:
<script type="text/javascript">
$('select').select2({
placeholder: 'Select an item',
ajax: {
url: '{{ path('user_games_json') }}', //url to the json data
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: data
};
},
cache: true
}
});
</script>