I am trying to obtain a list of assets (via JSON) inside of a drop using a free drop.io account.
Note that I have already looked at the other two questions (question1 and question2) concerning this and neither of them provided a solution.
var dropName = escape("greganddonny");
var apiKey = "some key I'm not displaying it here...";
var version = "2.0";
var assetsListBaseURL = "http://api.drop.io/drops/greganddonny/assets.json?api_key=" + apiKey + "&version=" + version;
var resultingdata = null;
function getFileList() {
console.log("BEGIN: getFileList()");
var surl = assetsListBaseURL + '&callback=?';
$.getJSON(surl, function(data, textStatus) {
console.log("textStatus:" + textStatus);
console.log("BEGIN: Callback()");
resultingdata = data;
showResult();
console.log("END: Callback()");
});
console.log("END: getFileList()");
}
function showResult()
{
alert(resultingdata);
}
$(document).ready(function() {
console.log("BEGIN: document.ready");
$.ajaxSetup({
"error": function(XMLHttpRequest,textStatus, errorThrown) {
alert(textStatus);
alert(errorThrown);
alert(XMLHttpRequest.responseText);
}
})
$("#search").click(function() {getFileList();});
console.log("END: document.ready");
});
When the search button on the page is clicked this triggers the getFileList() function. According to my firebug console the getFileList() function is called just fine.
The JSON request is also made successfully as the firebug console's Net tab displays a 200OK status when I call assets.json on drop.io's site. I also receive the following return JSON in the list of requests in the "Net" tab:
[{"converted":"http:\/\/drop.io\/download\/public\/x0yfnmzdtet1vtxesqcm\/12a9ebc74c9a3e4e3b2e2b4ea3546b919a2519ff\/df43d2b0-926f-012c-26c2-fbe072d62af6\/2a0a5270-9270-012c-8fc9-fbfd417303a8\/v2\/content","type":"audio","status":"converted","title":"MikeAndAndyOnPhone2009.MP3","duration":118,"artist":"Unknown","created_at":"2009/10/03 17:29:02 +0000","filesize":1895424,"description":null,"track_title":"Unknown","hidden_url":"http:\/\/drop.io\/hidden\/sazpcf7522exzb\/asset\/bWlrZWFuZGFuZHlvbnBob25lMjAwOS1tcDM=","name":"mikeandandyonphone2009-mp3"}]
I validated the above block of returned JSON using JSONLint and it reports that the JSON returned is indeed valid, you can test this out by copying and pasting the block above.
I've tried everything I know how to try, I've even added an "error" option to the $.ajaxSetup method and I still haven't had any success returning even an error message as to why my callback function is not being called.
Any idea why this might be? You can test out my script here