Search Results

Search found 1 results on 1 pages for 'rohancs'.

Page 1/1 | 1 

  • JSON + PHP + JQuery + Autocomplete problem...

    - by RohanCS
    Hi Everyone, Only started today but I'm having massive problems trying to understand JSON/AJAX etc, I've gotten my code this far but am stumped on how to return the data being pulled by the AJAX request to the jQuery Auto complete function. var autocomplete = new function (){ this.init = function() { $('#insurance_destination').autocomplete({source: lookup}); } function lookup(){ $.ajax({ url: "scripts/php/autocomplete.php", data: {query:this.term}, dataType: "json", cache : false, success: function(data) { for(key in data){ return { label: key, value: data[key][0] } } } }); } } And example of the JSON string being returned by a PHP script {"Uganda":["UGA","UK4","Worldwide excluding USA, Canada and the Carribbean"]}

    Read the article

1