javascript - selectize.js doesn't work with remote url -


i'm using selectize this:

$('#category_field').selectize({                   valuefield: 'name',                     searchfield: 'name',        delimiter: "/",                   options: [],        load: function(query,callback)        {                if(!query.length) return callback();                      $.ajax({                url: '/categories/autocomplete',                type: 'get',                datatype: 'jsonp',                data: {                                                    },                error: function() {                    callback();                },                success: function(res) {                    callback(res.movies);                }             });                      }               } 

);

"#category_field" form input of type text.

i verified ajax request being made , response server looks this:

[   {     "_id": {       "$oid": "568bee09421aa908fe000009"     },     "depth": 0,     "name": "math",     "parent_id": null,     "parent_ids": [],     "picture": {       "url": "/uploads/category/picture/568bee09421aa908fe000009/screenshot________________.png",       "thumb": {         "url": "/uploads/category/picture/568bee09421aa908fe000009/thumb_screenshot________________.png"       }     }   } ] 

my problem autocomplete dropdown menu doesn't show, ?

edit

i wanted mention i'm using bootstrap 3 , input field , label wrapped inside <div class=field>...</div>, div wrapped inside form wrapped inside container inside panel.

does relate problem ?

this response not looks valid json. check console, or/and use trycatch

try { $.ajax(...) } catch (err) { console.error(err); } 

and jsonp crossdomain method, maybe can try delete it.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -