// don't cache ajax or content won't be fresh $.ajaxSetup({ cache: false }); var feedId = "mthayes"; var apiKey = ""; // not needed for public feeds, use either api key or access key if the feed is not public var accessKey = ""; var apiBaseUrl = "//www.teleport.nu/api/v1"; var url = apiBaseUrl + "/feed-info?feedid=" + feedId + "&apikey=" + apiKey + "&accesskey=" + accessKey; $("#runButton").click(function () { $.ajax({ url: url, type: "GET", success: function (data, textStatus, jqXHR) { // got the result $("#resultJSON").html(jqXHR.responseText); // extract some properties var feed = data.FeedViewer; $("#feedName").html(feed.Name); $("#feedDescription").html(feed.Description); $("#feedLocalTime").html(feed.LocalTime); }, error: function (jqxhr, textStatus, error) { $("#resultJSON").html("Error: " + jqxhr.status + ', ' + textStatus + ', ' + error); } }); });
<button id="runButton">Run</button> <br/> <br/>Feed name: <div id="feedName"></div>Feed description: <div id="feedDescription"></div>Feed local time <div id="feedLocalTime"></div> <br/>Response JSON: <div id="resultJSON"></div>