作者:多米音乐_34306427 | 来源:互联网 | 2023-05-19 06:17
IhavethefollowingdatacurrentlyfeedingJQueryAutocomplete我有以下数据正在提供JQueryAutocompletevar
I have the following data currently feeding JQuery Autocomplete
我有以下数据正在提供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 modify this to retrieve the array of results from a php page. Can somebody help me to modify this so I can in Javascript do this?
我需要修改它以从php页面检索结果数组。有人可以帮我修改这个,所以我可以在Javascript中这样做吗?
network_autocomplete=data
Currently, the code retrieves data from an SQLite table in this manner:
目前,代码以这种方式从SQLite表中检索数据:
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'));
}
3 个解决方案