Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reload JSON with AJAX every 10 Seconds
    primarykey
    data
    text
    <p>I'm trying to reload a JSON file every 10 seconds with JQUERY.</p> <p>The page is here: <a href="http://moemonty.com/chirp/chirp.html" rel="noreferrer">http://moemonty.com/chirp/chirp.html</a></p> <p>The Code is here:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;the title&lt;/title&gt; &lt;!-- included Jquery Library --&gt; &lt;script type="text/javascript" src="./js/jquery-1.4.2.js"&gt;&lt;/script&gt; &lt;!-- jquery library --&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; $.ajaxSetup({ cache: false }); //disallows cachinge, so information should be new function loadChirp(){ //start function var url = "http://www.chirpradio.org/json"; $.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22"+url+"%22&amp;format=json&amp;callback=?", function(data){ console.log(data.query.results.json); document.write('The artist is: ' + data.query.results.json.artist + '&lt;br/&gt;&lt;br/&gt;'); document.write('The artist is: ' + data.query.results.json["record-label"] + '&lt;br/&gt;&lt;br/&gt;' ); document.write('The album is: ' + data.query.results.json.album + '&lt;br/&gt;&lt;br/&gt;'); document.write('The record label is: ' + data.query.results.json["record-label"] + '&lt;br/&gt;&lt;br/&gt;'); document.write('The feedback link is: ' + data.query.results.json["feedback-link"] + '&lt;br/&gt;&lt;br/&gt;'); document.write('The database id is: ' + data.query.results.json["database-id"] + '&lt;br/&gt;&lt;br/&gt;'); document.write('The time is: ' + data.query.results.json.timestamp.time + ' '); document.write(data.query.results.json.timestamp["am-pm"] + '&lt;br/&gt;&lt;br/&gt;'); document.write('The current dj is: ' + data.query.results.json["current-dj"] + '&lt;br/&gt;&lt;br/&gt;'); setTimeout("loadChirp()",5000); alert('The timeout was triggered.'); }); } //end function $(document).ready(function(){ //DOCUMENT READY FUNCTION loadChirp(); }); //DOCUMENT READY FUNCTION &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>It doesn't seem to be working.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload