Monday 15 September 2014

javascript - Autocomplete Jquery UI... Bug with json -



javascript - Autocomplete Jquery UI... Bug with json -

i've got problem autocomplete script... if utilize json file info displayed autocomplete doesn't work.. in contrast, if utilize table npa, works...

someone can help me problem ? !

my autocomplete.php

var npa = 'npa.json'; var npa2 = [{"value": "1700","label": "newyork city"},{"value": "1701","label": "chicago"}]; $('#tags').autocomplete({ source: npa2, minlength: 1 });

my npa.json :

[{"value": "1700","label": "newyork city"},{"value": "1701","label": "chicago"}]

your content of npa should string of npa.json. , not content of file.

yo should load content of json file:

var npa = 'npa.json'; $.getjson(npa, function(data) { $('#tags').autocomplete({ source: data, minlength: 1 }); });

javascript jquery json autocomplete

No comments:

Post a Comment