これをYouTubeAPIに投稿しようとしているので、本当にイライラしています。ただし、Ajaxを使用すると、構文が予期しないt変数エラーが発生します。
コードは次のとおりです。
$.ajax({
url:"gdata.youtube.com/feeds/api/users/default/subscriptions",
type:"POST",
data:"<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<category scheme='http://gdata.youtube.com/schemas/2007/subscriptiontypes.cat'
term='channel'/>
<yt:username>GoogleDevelopers</yt:username>
</entry>",
Authorization: token,
GData-Version: '2',
X-GData-Key: 'key=MYDEVKEY',
contentType:"application/atom+xml",
dataType:"xml",
success: function(){
alert('subscribd');
}
});
そして、いくつかの調査で、コードの最初の行がエラーの原因であることがわかりました。そのデータをAPIに投稿する方法はありますか?ああ、ドキュメントaはhttps://developers.google.com/youtube/2.0/developers_guide_protocol_subscriptions#Adding_a_subscriptionにあります。このデータを投稿する方法についてサポートをいただけますか?ありがとう!