Skip to content

Commit

Permalink
ensure ajax response is valid json
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan committed Oct 16, 2024
1 parent 8d180df commit 1871ac3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Zookeeper Online
//
// @author Jim Mason <jmason@ibinx.com>
// @copyright Copyright (C) 1997-2024 Jim Mason <jmason@ibinx.com>
// @copyright Copyright (C) 1997-2023 Jim Mason <jmason@ibinx.com>
// @link https://zookeeper.ibinx.com/
// @license GPL-3.0
//
Expand Down Expand Up @@ -220,7 +220,7 @@ $().ready(function(){
accept: 'application/json; charset=utf-8',
url: url
}).done(function (response) {
$("#time").empty().append(response).selectmenu('refresh');
$("#time").empty().append(response.times).selectmenu('refresh');
var time = $("#time").val();
populateCards(true, time == 'now' ? null : (date + " " + time));
});
Expand Down
2 changes: 1 addition & 1 deletion ui/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function makeTimePicker($date=null) {
public function getTimes() {
$this->setTemplate('onnow.html');
$this->makeTimePicker($_REQUEST["date"] ?? null);
echo json_encode($this->render('time'));
echo json_encode([ "times" => $this->render('time') ]);
}

public function emitHome() {
Expand Down

0 comments on commit 1871ac3

Please sign in to comment.