Bernd Wurst commited on 2018-01-28 10:52:31
Zeige 1 geänderte Dateien mit 4 Einfügungen und 7 Löschungen.
... | ... |
@@ -31,18 +31,15 @@ $term = $_GET['term']; |
31 | 31 |
|
32 | 32 |
$allentries = build_results($term); |
33 | 33 |
|
34 |
-$lines = array(); |
|
34 |
+$out = array(); |
|
35 |
+ |
|
35 | 36 |
foreach ($allentries as $entry) { |
36 |
- $lines[] = " { \"id\": \"".filter_input_general($entry['id'])."\", \"value\": \"".filter_input_general($entry['value'])."\" }"; |
|
37 |
+ $out[] = array('id' => $entry['id'], 'value' => $entry['value']); |
|
37 | 38 |
} |
38 | 39 |
|
39 | 40 |
|
40 |
- |
|
41 | 41 |
header("Content-Type: application/json"); |
42 |
-echo "[\n"; |
|
43 |
-echo implode(",\n", $lines); |
|
44 |
-echo ' |
|
45 |
-]'; |
|
42 |
+echo json_encode($out); |
|
46 | 43 |
die(); |
47 | 44 |
|
48 | 45 |
|
49 | 46 |