【发布时间】:2017-08-02 15:25:26
【问题描述】:
您好,感谢您帮助我,英语不是我的母语,提前抱歉。 :)
选择选择框时,我收到“未找到结果”的通知,但是当我在开发人员工具栏中查看结果时,我看到我收到了完整的 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>
【问题讨论】:
标签: ajax symfony jquery-select2