I'm trying to get a JSONP $.ajax
request working. It works fine in Chrome and IE but it is failing in Firefox v30.
When it fails it doesn't given any error - at least Firebug doesn't show any errors, it just never calls the callback function.
This is a basic demo site (http://andysylvester.com/files/reader/) will work with Chrome and IE but not Firefox.
The nytRiver.js JSON call actually returns a javascript function call to onGetRiverStream
see the documentation here: http://riverjs.org/#structureOfRiverjs
<html>
<head>
<title>Minimal River.js Feed Reader</title>
<script src="http://fargo.io/code/jquery-1.9.1.min.js"></script>
<script>
var theRiver;
function onGetRiverStream (updatedFeeds) {
theRiver = updatedFeeds;
displayFeeds();
}
$.ajax ({
url: "http://rss.scripting.com/rivers/nytRiver.js",
dataType: "jsonp"
});
function displayFeeds() {
var feedText = "";
// Create title
for (var i in theRiver.updatedFeeds.updatedFeed) {
feedText = feedText + theRiver.updatedFeeds.updatedFeed[i].feedTitle + " <a href=" + theRiver.updatedFeeds.updatedFeed[i].feedUrl + "> (Feed) " + "</a><br>";
feedText = feedText + "<a href=" + theRiver.updatedFeeds.updatedFeed[i].item[0].link + ">" + theRiver.updatedFeeds.updatedFeed[i].item[0].title + "</a><br>";
feedText = feedText + theRiver.updatedFeeds.updatedFeed[i].item[0].body + "<br>";
feedText = feedText + "<br>";
}
document.getElementById("demo").innerHTML = feedText;
}
</script>
</head>
<body>
<h1><center>Minimal River.js Feed Reader</center></h1>
<p id="demo">Wating for feeds to load....</p>
</body>
</html>