views:

78

answers:

2

hi guys! im just tryin to get my zootool items via js to push them in my blog's footer...but with no success. here's the code im using (jquery framework)

jQuery(document).ready(function($)
{

//first try
var url = "http://zootool.com/api/users/items/?username=USER_NAME&apikey=API_KEY&jsonpcallback=?"
$.getJSON(url, function(data){ console.log(data); });

//second try
url2 = "http://zootool.com/api/users/items/?";
data = "username=USER_NAME&apikey=API_KEY";

$.ajax(
{
 url: url2, dataType: 'jsonp', data: data,
 success: function(data){ console.log(data); }
});

}

webkit based browser tells me that: "Resource interpreted as script but transferred with MIME type application/json."

firefox works good, i get an application/json; utf-8 object that i can parse succesfully. do you know what could be the problem? thanks a lot in advance!

Luca

+1  A: 

A JSONP response is not really JSON but JavaScript, so the Content-Type in the response header should be application/javascript.

raffel
A: 

directly from the creator of zootool:


the api hasn't supported callbacks for jsonp so far. I just added them so your first version should work with a little adjustment. you have to rename jsonpcallback to callback to make it work. take a look here:

http://pastebin.com/vA9wcySa

Luca