So assuming I have a data attr set on the link and window object contains the logged in user and when I logged in I passed the flag: user_follows_edit
This should work:
$('body').on('click', '.twitch-follow', function () {
var twitch_target = $(this).attr("data-twitch-name");
var twitch_name = window.twitch_name;
var twitch_follow_url = "/users/" + twitch_name + "/follows/channels/" + twitch_target;
Twitch.api({
method: twitch_follow_url,
verb: "PUT"
},
function (error, channel) {
if (error) {
alert('error');
}
if (channel) {
alert('Sucess');
}
});
});
But I always get a SUCCESS response of the channel object. When I use PUT or DELETE.
Nothing happens and XHR shows a type of GET response.
Can some one do a quick test to ensure I am not going mental please 