title: Loading Vimeo video using jQuery + ajax
body: <p>I'm having troubles reading a Vimeo video using the OEMBED api with jQuery.</p>
  
  <p>My javascript is</p>
  
  <pre><code>    function loadVideo(params, callback) {
          $.ajax({
              type : "GET",
              url : "http://www.vimeo.com/api/oembed.json",
              data : params,
              dataType : "json",
              success : function(result) {
                  alert("calling callback");
                  callback(result);
              },
              error : function(error) {
                  var s = "";
                  $.each(error, function(name, value){
                      s += name + ": " + value + "\n";
                  });
                  alert(s);
              }
          });
      };
  </code></pre>
  
  <p>and I call this function like that</p>
  
  <pre><code>    loadVideo({
          "url" : $(this).attr("url"),
          "title" : $(this).attr("show-title"),
          "byline" : $(this).attr("show-byline"),
          "portrait" : $(this).attr("show-portrait"),
          "color" : "ffffff",
          "width" : 120
      }, function(result) {
          alert("Setting video content");
          $(this).html(unescape(result.html));
      });
  </code></pre>
  
  <p>where $(this) is the element where the video has to be loaded.</p>
  
  <p>Inspecting the request</p>
  
  <pre><code>    Request URL:http://vimeo.com/api/oembed.jsonurl=https%3A%2F%2Fvimeo.com%2F38578157&amp;title=false&amp;byline=false&amp;portrait=false&amp;color=ffffff&amp;width=120&amp;callback=%3F
      Request Headers
      Referer:http://localhost:8080/artwriter/art
      User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1
      Query String Parameters
      url:https://vimeo.com/38578157
      title:false
      byline:false
      portrait:false
      color:ffffff
      width:120
  </code></pre>
  
  <p>This request looks correct (and effectively if I copy and paste in my browser I get this json result</p>
  
  <pre><code>{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"http:\/\/vimeo.com\/","title":"Test video 1","author_name":"Stefano Cazzola","author_url":"http:\/\/vimeo.com\/user10866085","is_plus":"0","html":"    &lt;iframe src=\"http:\/\/player.vimeo.com\/video\/38578157?title=0&amp;amp;byline=0&amp;amp;portrait=0&amp;amp;color=ffffff\" width=\"120\" height=\"90\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen&gt;&lt;\/iframe&gt;\n\n\n","width":120,"height":90,"duration":165,"description":"","thumbnail_url":"http:\/\/b.vimeocdn.com\/ts\/265\/600\/265600694_100.jpg","thumbnail_width":100,"thumbnail_height":75,"video_id":38578157}
  </code></pre>
  
  <p>However something goes wrong and I end up in the ajax error callback.</p>
  
  <p>Any ideas?</p>