Mannu Nayyar Mannu Nayyar - 1 year ago 85
jQuery Question

tokenfield with jquery ui autocomplete

I am using Bootstrap tokenfield with jQuery UI autocomplete. But the list is not displaying any thing except blank fields.

This is my code:

$('#country').tokenfield({
autocomplete: {
source: "/country", minLength: 1
},
showAutocompleteOnFocus: true
});


Source is returning appropriate data but the autocomplete suggestion is blank.

Is there any fix for this or am i missing something in my code? Please help me with this.

Data returned from source(when I type
ind
):-

[
{"id":"1","dat":"India"},
{"id":"2","dat":"Indonesia"}
]


Thanks

Raj Raj
Answer Source

the data returned should be of this format

[
   {"value":"1","label":"India"},   
   {"value":"2","label":"Indonesia"}              
]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download