Having some trouble getting a JSON feed to load from my site. I'm starting to think something is wrong with the feed itself, since plugging the address into a variety of different blocks of example code doesn't seem to work.
I've tried the examples below, and continually meet with "Origin null is not allowed by Access-Control-Allow-Origin" when trying to deep drill the error through Chrome's Javascript Console. Any ideas?
Try #1:
<script type="text/javascript">
$().ready(function(){
var url = 'http://www.solidverbal.com/category/clicks?feed=json';
$.get(url, function(data) {
// can use 'data' in here...
});
});
</script>
Try #2:
<script type="text/javascript">
$.ajax({
type: "POST",
url: "http://www.solidverbal.com/category/clicks?feed=json",
data: '{}', // your parameter goes here
contentType: "application/json; charset=utf-8",
dataType: "json",
processdata: true,
success: function (msg) {
loadDetails(msg.d); // msg.d contains the JSON data being returned
},
error: function (msg, error, obj) {
alert(msg.responseText);
}
});
function loadDetails(results) {
// depending on the data in the JSON object, you can access them using
// the syntax results.<propertyname> etc…
}
</script>
origin nullmeans you're running this on your local machine's file system. Chrome won't let you do AJAX calls when doing this.