【发布时间】:2017-04-28 08:33:00
【问题描述】:
我有一个从后端发送的数组,我从中创建一个新的对象数组,然后我使用 JSON.stringify 使其为selectize 做好准备,然后该数组如下所示:
[{"question":"Challenge question"},{"question":"Challenge question"},{"question":"Challenge question"}... and so on
我正在尝试使用带有 selectize 的新数组,但没有呈现任何选项:
这是脚本:
var engagementsOptions = [];
icoop.engagements.map(function(item) {
engagementsOptions.push({
"question" : item
});
});
$('#engagement_question').selectize({
options: JSON.stringify(engagementsOptions),
create: true,
});
【问题讨论】: