200 OK 123ms data is null $.getJSON('http://'+options.server+'/j...$.each(data.mounts,function(i,mount){
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" > <xsl:output method="text" media-type="text/plain" indent="yes" encoding="UTF-8" /> <xsl:template match = "/icestats" > <!-- <xsl:param name="callback" /> --> <!-- <xsl:value-of select="$callback" /> --> parseMusic ( { <xsl:for-each select="source"> "<xsl:value-of select="@mount" />" : { "listeners" : "<xsl:value-of select="listeners" />", "description" : "<xsl:value-of select="description" />", "artist" : "<xsl:value-of select="artist" />", "title" : "<xsl:value-of select="title" />", "genre" : "<xsl:value-of select="genre" />", "url" : "<xsl:value-of select="server_url" />", </xsl:for-each> "total" : "<xsl:value-of select="listeners" /><xsl:for-each select="source"><xsl:if test="position() != last()"></xsl:if></xsl:for-each>" }, } ); </xsl:template> </xsl:stylesheet>
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8" /> <title>Icecast2 Satat</title> <script src='http://code.jquery.com/jquery-1.7.1.js'></script> <script> // немного кастомизации var mountpoint = "/live"; //маунт с которого берем инфу в массиве var counter=0; var url = "http://radio.example.com:8000/json.xsl?"; //наш url к json в папке Web url+= "mount=" + mountpoint + "&callback="; function parseMusic(results) { // #id >> data var nm = results[mountpoint]; $('#artist').text(nm["artist"]); $('#title').text(nm["title"]); $('#total').text(nm["total"]); $('#genre').text(nm["genre"]); } var span; var script; $.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"}); function initMusic() { span = document.createElement("span"); span.id="getscript"; document.body.appendChild(span); script = document.createElement("script"); script.type="text/javascript"; script.charset="UTF-8"; } function addMusic() { $('#getscript').empty(); script.src = url + counter; $('#getscript').append(script); } function updateMusic() { counter=counter+1; // счетчик для наглядности частоты обновления addMusic(); $('#counter').text(counter); } $(document).ready( function () { initMusic(); addMusic(); setInterval('updateMusic()', 3000 ); // интервал обновления, сейчас 3 сек. }); </script> </head> <!-- Выводим полученные данные на страницу --> <body> <span id="artist"></span> - <span id="title"></span> (<span id="total"></span> listeners) <span id="counter"></span> </body> </html>
var mountpoint = "/live"; //маунт с которого берем инфу в массиве
function parseMusic(results) { // #id >> data var nm = results['mountpoint1']; if(nm["title"] =='') nm = results['mountpoint2']; $('#artist').text(nm["artist"]); $('#title').text(nm["title"]); $('#total').text(nm["total"]); $('#genre').text(nm["genre"]); }
var url = "http://radio.example.com:8000/json.xsl?"; //наш url к json в папке Web url+= "mount=" + mountpoint + "&callback=";
var urlSecond =http://radio.example.com:8000/json.xsl?"; //наш url к json в папке Web urlSecond+= "mount=" + mountpoint2 + "&callback=";
function addMusic() { $('#getscript').empty(); script.src = url + counter; $('#getscript').append(script); }
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8" /> <title>Icecast2 Satat</title> <script src='http://code.jquery.com/jquery-1.7.1.js'></script> <script> // немного кастомизации var mountpoint = "/bodr"; var mountpoint2 = "/ametrin";//нонстоп var nac = true; var counter=0; var url = "http://listen.rcast.pro:8000/json.xsl?"; //наш url к json в папке Web var url2 = url; url+= "mount=" + mountpoint + "&callback="; url2+="mount=" + mountpoint2 + "&callback="; function parseMusic(results) { // #id >> data for (var n in results){ var nm = results[n]; if(nm["title"] && nac){ nac = false; $('#artist').text(nm["artist"]); $('#title').text(nm["title"]); $('#total').text(nm["total"]); $('#genre').text(nm["genre"]); } } } var span; var script; $.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"}); function initMusic() { span = document.createElement("span"); span.id="getscript"; document.body.appendChild(span); script = document.createElement("script"); script.type="text/javascript"; script.charset="UTF-8"; } function addMusic() { nac = true; $('#getscript').empty(); script.src = url + counter; $('#getscript').append(script); script.src = url2 + counter; $('#getscript').append(script); } function updateMusic() { counter=counter+1; // счетчик для наглядности частоты обновления addMusic(); $('#counter').text(counter); } $(document).ready( function () { initMusic(); addMusic(); setInterval('updateMusic()', 3000 ); // интервал обновления, сейчас 3 сек. }); </script> </head> <!-- Выводим полученные данные на страницу --> <body> <span id="artist"></span> - <span id="title"></span> (<span id="total"></span> listeners) <span id="counter"></span> </body> </html>
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8" /> <title>Icecast2 Satat</title> <script> // немного кастомизации var mountpoint = "/bodr"; var mountpoint2 = "/ametrin";//нонстоп var nac = true; var counter=0; var url = "http://listen.rcast.pro:8000/json.xsl?"; //наш url к json в папке Web var url2 = url; url+= "mount=" + mountpoint + "&callback="; url2+="mount=" + mountpoint2 + "&callback="; function parseMusic(results) { // #id >> data for (var n in results){ var nm = results[n]; if(nm["title"] && nac){ nac = false; $('#artist').text(nm["artist"]); $('#title').text(nm["title"]); $('#total').text(nm["total"]); $('#genre').text(nm["genre"]); } } } var span; var script; $.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"}); function initMusic() { span = document.createElement("span"); span.id="getscript"; document.body.appendChild(span); script = document.createElement("script"); script.type="text/javascript"; script.charset="UTF-8"; } function addMusic() { nac = true; $('#getscript').empty(); script.src = url + counter; $('#getscript').append(script); script.src = url2 + counter; $('#getscript').append(script); } function updateMusic() { counter=counter+1; // счетчик для наглядности частоты обновления addMusic(); $('#counter').text(counter); } $(document).ready( function () { initMusic(); addMusic(); setInterval('updateMusic()', 3000 ); // интервал обновления, сейчас 3 сек. }); </script> </head> <!-- Выводим полученные данные на страницу --> <body> <span id="artist"></span> - <span id="title"></span> (<span id="total"></span> listeners) <span id="counter"></span> </body> </html>