user2595123
user2595123

Reputation: 141

java script to like youtube video

i made a function in java script to like youtube video code is

 function LikesDislikes ()
{

$.ajax({

url: 'gdata.youtube.com/feeds/api/videos/U5wVEr91Kpw/ratings',
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"><yt:rating value="like"/></entry>',

headers:

 {

    "Content-Type":"application/atom+xml",

    "Authorization":"Bearer ya29.AHES6ZQru5sIgtlj7a_-C7HkjYQH-9AwYwL8CWay3b2ZiHc",
    "X-GData-Key":"key=AIzaSyAPrtP2Tq4m5WVInCvCWptVAKPhQ4SQNZA",
    "GData-Version":"2"
  }


  });

 }

Can any one help me i don't know code is right or not i m getting error 400 not found ,please help me

thanks

Upvotes: 0

Views: 1577

Answers (1)

Quentin
Quentin

Reputation: 943996

You forgot to put http:// on the front of your URL, so you are making the request to your own server.

(But you would probably be best off throwing all this code away and using the JavaScript library that Google provide.)

Upvotes: 1

Related Questions