php - How to Pass json data to jquery autocomplete -


Hi guys,

Does anyone help me pass this JSON data to the Json automple plugin Does ... as I'm a newbie for jquery, how do I want to do it ...

  [["0": "1", "id": "1 "", "" "," "Albania", "Country": "Albania"}, "Country": "Albania"}, "" "," Algeria "}," "", "", "," id "3", "id": "3", "1": "Angola", "Country": "2", "1" "4", "id": "4", "1": "3" "Anguilla"}, "Anguilla"}, {"0": "5", "ID": "5", "Anguilla", "4", "Antigua", "Country": "Anguilla", "Country" "1" "7", "id": "7", "id": "6", "id": "6 {"0": "1": "Armenia", "Country": "Armenia"}, {"0": "8", "1": "Argentina", "Country": "Argentina"}, {"0": "1" "Id": "8", "1": "Aruba", "Country": "Aruba"}, {"0": "9", "id": "9", "1": "Australia" "Country": "" "," ":" 11 ":" 10 "," id ":" 10 "," 1 ":" Austria "," Country ":" Austria "}, {" 0 ":" 11 "" "": "26", "id": "11", "1": "Azerbaijan", "Country": "Azerbaijan"} "," 27 "," id ":" "" "": "26", "id" "" "Bulgaria", "Country": "Bulgaria"}, {"0": "27", "1": "Burkina Faso", "Country": "Burkina Faso"}]  

from where Not coming? Unless it is JSON, it may be better to put it in another format; Jquery.autocomplete plugin is not built in JSON handling, so you have to handle your tasks.

Considering that this data never changes, you can save it to a javascript file (say, Country JS) instead of using the following format:

 < (Country of origin: "Algeria"), {ID: 3, country (ID: 7, country: "Anguilla"}, {0} ID: 4, Country: "Anguilla"}, {ID: 5, Country: "Antigua"}, {ID: 6, Country: "Argentina"}, (ID: 10, Country: "Austria"}, {ID: 11, Country: "Azerbaijan"), "Azerbaijan", (ID: 8, Country: "Aruba"}, { (ID: 27, Country: "Burkina Faso"}];  

"ID: 26, country:" ID: 26, country: "Bulgaria"}, {ID: After that, you call the plug-in in your main file:

  & lt;! DOCTYPE HTML PUBLIC "- // W3C // DTT HTML 4.01 // n" "http: //www.w3.org/TR/html4/strict.dtd">< html> gt; Top & gt; script; src = "jquery.js" & gt; & lt; / Script> gt; script src = "jquery.autocomplete.js">  



  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -