【发布时间】:2014-06-17 06:22:30
【问题描述】:
我正在使用远程数据 (json) 初始化 select2(multiple),当提交表单时 select2 提交所选文本的索引,它是否可以返回所选文本(以逗号分隔,如索引)而不是索引?
<input type="hidden" id="IntendedCourses" name="IntendedCourses"/>
$.getJSON("GetCourses.aspx", function (course) {
$("#IntendedCourses").select2({
multiple: true,
data: course
});
});
json格式:
[{"id":"0","text":"Accounting"},{"id":"1","text":"Accounting & Finance"},{"id":"2","text":"Aeronautical"},{"id":"3","text":"Aerospace Engineering"}]
【问题讨论】: