The format for my select 2 is as such:
$("#selectPretty").select2({
tokenSeparators: [","],
tags:["1", "2", "3", "php", "tiger", "test", "big bang theory", "bikes", "gh", "sd", "cheese", "food", "name", "jack", "chickens", "yikes!", "testing", "this", "is", "a", "questionj", "new", "question", "s"]
});
Which shows as such:
BUT, when I try to assign data into the box dynamically through AJAX by using this code:
$.ajax({
type: "POST",
url: "grabTags.php",
data: "tags="+$("#selectPretty").val(),
success:
function(msg2) {
alert(msg2);
$("#selectPretty").select2({
tokenSeparators: [","],
tags:[msg2]
});
}
});
It will come out like so:
For some reason the whole string is one option and I can't make it explode the result into different options...
Does anyone know what I can do here?
Note that 'tags:[msg2]' is returned from my grabTags.php file and 'msg2' = "1", "2", "3, etc...
Kindest Regards