I am trying to get the response json of an oEmbed request. Heres the code:
var _url = 'http://www.youtube.com/oembed?url=http%3A//youtube.com/watch%3Fv%3DM3r2XDceM6A&format=json';
$.ajax({
url: _url,
type: 'GET',
dataType: 'jsonp',
crossDomain: true,
success: function(){
alert(this.responseText);
},
error: function(){
alert('error');
}
});
The console throws the error:
[Error] SyntaxError: Unexpected token ':'. Parse error. (anonymous function) (oembed, line 1)
Update
I have corrected the dataType
property to json
. That seems to have solved that problem. Now I am getting an Access-Control-Allow-Origin
error.