JavaScript JSON Example

DeveloperWunDeveloperWun Registered Users Posts: 3 Beginner grinner
Is there any code out there that will show me how to AJAX get a gallery feed via JSON? I have two clients who want to display their gallery on their site but the iframe method just doesn't work too well. It gets clipped and they want to customize the look and feel of it on their site.

I can get an XML feed of the data, but want to get it via JSON, or at least be able to pull it in via JQuery if it has to be XML. My code below doesn't work. I get this error:

Object {responseData: null, responseDetails: "Feed could not be loaded.", responseStatus: 400}


Here's my code:

<script type="text/javascript">
$(function () {
var FEED_URL = "http://api.smugmug.com/hack/feed.mg?Type=nicknameRecentPhotos&Data=omphotography&format=atom10&Sandboxed=1";

$.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(FEED_URL),
dataType: 'json',
sandboxed: 1,
success: function (data) {
console.log(data);
}
});
});
</script>


*And please don't tell me to double encode it. I already tried that.

Comments

Sign In or Register to comment.