Question

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!

Was it helpful?

Solution 2

Thanks for the help.

This question has been resolved.

Instagram doesn't allow JSONP requests :)

OTHER TIPS

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top