Domanda

Why PINTEREST API not working with $.getJSON ?

var pin = 'http://api.pinterest.com/v1/urls/count.json?callback=receiveCount';  
$.getJSON( pin, {
    url:'http://www.google.com',    
})
.done(function( data ) {
    console.log( data );
}); 

I check the call and hit it. Getting correct results

È stato utile?

Soluzione

The url should be

var pin = 'http://api.pinterest.com/v1/urls/count.json?callback=?';
$.getJSON(pin, {
    url: 'http://www.google.com',
}).done(function (data) {
    console.log(data);
});

If you pass a hard coded jsonp callback function then you need to implement it, the easiest solution is to just make jQuery to create the jsonp callback function

Demo: Fiddle

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top