jquery ajax vs browser url

Posted by danwoods on Stack Overflow See other posts from Stack Overflow or by danwoods
Published on 2010-06-03T02:17:41Z Indexed on 2010/06/03 2:24 UTC
Read the original article Hit count: 270

Filed under:
|
|
|
|

Hello all,
I'm trying to use youtube's api to bring back a listing of a user's videos. The request url looks something like:
http://gdata.youtube.com/feeds/api/users/username/uploads
with 'username' being the correct username. This bring back the appropriate url in the browser. However when I try to access that url via jQuery's $.ajax or $.get functions, using something like:

$.ajax({   

    //set parameters
    url: "http://gdata.youtube.com/feeds/api/users/username/uploads",
    type: "GET",

    //on success
    success: function (data) {
      alert("xml successfully captured\n\n" + data);
    },
    //on error
    error:function (XMLHttpRequest, textStatus, errorThrown, data){
      alert(" We're sorry, there seem to be a problem with our connection to youtube.\nYou can access all our videos here: http://www.youtube.com/user/username");
      alert(data);
    }      
  });

  $.get("http://gdata.youtube.com/feeds/api/users/username/uploads", function(data){
    alert("Data Loaded: " + data);
  });

I get an empty document returned. Any ideas why this is?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX