I have the following data that is currently submitting jQuery autocomplete
var network_autocomplete=[ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $( "#network" ).autocomplete({ source: network_autocomplete });
I need to change this to get an array of results from a php page. Can someone help me change this so that I can do this in JavaScript?
network_autocomplete=data
Currently, the code retrieves data from an SQLite table as follows:
try { $db = new PDO('sqlite:/tmp/bacnet.db'); $query = "SELECT net, name, FROM network"; foreach ($db->query($query) as $row) { $networks[] = array('net' => $row['net']); } echo json_encode($networks); return json_encode($networks); } catch (PDOException $e) { echo json_encode(array('message' => 'Could not connect to the database')); }
Tara
source share