-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>