diff --git a/ajax/ajax_getjukebox.php b/ajax/ajax_getjukebox.php
index 6fe3faa..0858c69 100644
--- a/ajax/ajax_getjukebox.php
+++ b/ajax/ajax_getjukebox.php
@@ -6,21 +6,22 @@ $query = "SELECT id, songid FROM " . INSTANTQTABLE . " ORDER BY id";
$sth = $globaldbh->prepare($query);
$sth->execute();
$data = array();
-$firstsong = true;
+$data["jukebox"] = array();
while ( $row = $sth->fetch() ) {
$id = $row['id'];
$song = new Song($row['songid']);
- echo "
\n";
- echo "
\n";
- echo "
\n";
- echo "
Song: {$song->getTitle(HTMLSAFE)}
\n";
- echo "
Artist: {$song->getArtist(HTMLSAFE)}
\n";
- echo "
Album: {$song->getAlbum(HTMLSAFE)}
\n";
- echo "
\n";
- echo "
\n";
- echo "
\n";
+ $curdata = array();
+ $curdata["id"] = $song->getID();
+ $curdata["arturl"] = $song->getArtFile(ARTURL);
+ $curdata["title"] = $song->getTitle(HTMLSAFE);
+ $curdata["artist"] = $song->getArtist(HTMLSAFE);
+ $curdata["album"] = $song->getAlbum(HTMLSAFE);
+ $curdata["year"] = $song->getYear(HTMLSAFE);
+ $data['jukebox'][] = $curdata;
}
+
+header('Content-Type: application/json');
+echo json_encode($data);
exit();
-
-?>
+// vim: sw=3 ts=3 ai mouse-=a:
diff --git a/js/minimal.js b/js/minimal.js
index 0ef2fef..b201f04 100755
--- a/js/minimal.js
+++ b/js/minimal.js
@@ -247,9 +247,9 @@ function getJukeboxList() {
gettingJukeboxList = true;
$.ajax({
url: 'ajax/ajax_getjukebox.php',
- dataType: 'html',
+ dataType: 'json',
success: function(data, stat, jqo) {
- $('#jukebox_contents').html(data);
+ $('#jukebox_contents').html(generateSongListHTML("juke", data.jukebox));
gettingSongList = false;
gettingJukeboxList = false;
}