【发布时间】:2015-05-11 09:07:11
【问题描述】:
我正在使用 jQuery Tokeninput 来接收类别列表。它看起来像这样:
{id: 1, type: 1, name: "Category1"},
{id: 2, type: 2, name: "Category2"},
{id: 3, type: 1, name: "Category3"},
{id: 4, type: 1, name: "Category4"},
{id: 5, type: 2, name: "Category5"}
然后我想使用 ajax 将选定的令牌发送回服务器,但我只能发送具有 id 或类型或名称的数组。而且我需要发送与我收到的相同的 JSON,相同的结构和格式,但只发送选定的令牌。
我尝试使用 tokenValue 参数,但它只需要 1 个参数,你不能告诉他构建 JSON。
【问题讨论】:
-
你想使用tokeninput向函数发送多个参数吗?
-
我正在使用 tokeninput 在字段内创建一组标签。之后,我需要将选定的标签传递到其他地方。但是 tokeninput 只执行 ID 数组。我需要所选项目的完整 JSON,包括名称、类型和 ID。
-
但是tokeninput输出总是像{"id":"1035","name":"John"},但是你需要3个输出..插件本身不支持跨度>
-
有带3个参数的解决方案吗?
-
编写自己的插件 :(
标签: javascript jquery ajax json jquery-tokeninput