javascript - Select2 selected options with ajax -


i'm using select2 generic filters. options server ajax request, need set selected options data cookie.

i'm trying with:

$("#categoriesselector").select2("val",["01002"]); $("#categoriesselector").val(["01002"]); $("#categoriesselector").select2().val(["01002"]); 

but not works. idea happening? thanks, iván.

from select2 docs have set data when calling select2, so:

$('#categoriesselector').select2({   data: [     {       id: '01002',       text: '01002'     }   ] }); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -