Having issues with PUT request to follow a channel

    Twitch.api({method: 'user'}, function(error, user)
    {
        if(error) return failure("2");
        var xmlHttp = new XMLHttpRequest();
        var url = "https://api.twitch.tv/kraken/users/" + user.name + "/follows/channels/" + channel;
        xmlHttp.open('PUT', url, true);
  	xmlHttp.onreadystatechange = function()
        {
            if (xmlHttp.readyState==4) 
            {
                var check=xmlHttp.status;
  			alert(check);
  			if (check.toString()=="200")
  			{
  				success();
  			}
            }
            else 
            {
                failure("3"); // This is the step that my code fails at currently.
            }
        };
        xmlHttp.setRequestHeader("Content-Type", "application/json");
        xmlHttp.setRequestHeader("Accept", "application/vnd.twitchtv.v3+json");
        xmlHttp.setRequestHeader("Authorization", "OAuth " + Twitch.getToken());
        xmlHttp.setRequestHeader("Content-Length", "0");
        xmlHttp.send();
    });
});