Just started using token-input, and i didn't manage to make it work the way I wanted. Let me explain :
I was given a String var in javascript, containing data, like token-input local data:
var str='[{id : 1, name : "ADM" },
{id : 2, name : "JCH" },
{id : 3, name : "CGD" }]';
However, I couldn't give a str as a parameter to tokeninput, like this:
$("#input").tokenInput(str, {preventDuplicates : true});
It gives me what I think is error code 500.
Error probably comes with the quote returned by the str var. Problem is I need to use this var, it's kinda imposed.
Any ideas?
What you should do is
$("#input").tokenInput(JSON.parse(str), {preventDuplicates : true});