문제

Ok so I have been trying for the last two hours to get a like on an image... I use this call:

$.ajax({
   method: "POST",
   url: 'https://api.instagram.com/v1/media/'+$media_id+'/likes?access_token='+$access_token,
   dataType: "jsonp",
   jsonp: "callback",
   jsonpCallback: "jsonpcallback",
   success: function(data) {
       console.log(data);
       alert('success liked');
   },
   error: function(jqXHR, textStatus, errorThrown) {
       alert( "Feed Error! jqXHR: " + jqXHR + " textStatus: " + textStatus + " errorThrown: " + errorThrown );
   }
});

But for some reason it's not giving me a like rather just the list of likers?

On the documentation it uses the curl method for posting a like, however I need a javascript/jquery solution?

Any help would greatly be appreciated!

Thanks a mil!

도움이 되었습니까?

해결책 2

Thanks for the help.

This question has been resolved.

Instagram doesn't allow JSONP requests :)

다른 팁

you have to specify type:"POST" not method:"POST"

Since there is no type specified, it is doing a GET call and so it is getting list of likes :)

(btw POST may not work because of Cross-Origin Access, give it a shot)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top