0

I have the following code :

$.ajax({
    type: "GET",
    url: "http://www.flickr.com/services/oembed/?url=http%3A//" + picture_src +"?callback=?&format=json" ,
    cache: 'true',
    dataType: "jsonp", 
    success: function(output_data_flickr) {
    alert(output_data_flickr.url);
    if(output_data_flickr.url != ""){
        $('#picture_preview_link').attr('src', output_data_flickr.url); 
        $('#picture_link_embed').val(output_data_flickr.url);
    }
    else{
        $('#picture_link_embed').val(picture_src);
        $('#picture_preview_link').attr('src', picture_src);}
    }
});  

Why do I get errors like this when I try to get URL properties in firebug?

SyntaxError: invalid label
[Break On This Error]   

{"type":"photo","title":"Bacon Lollys","author_name":"\u202e\
olevegard
  • 5,294
  • 1
  • 25
  • 29

1 Answers1

0

I'm not sure how you're getting the success handler to fire without violating CORS. In this fiddle I've moved your handler to a separate callback function, included flickr api jsoncallback in the request params, and it works.

http://jsfiddle.net/9HxtU/5/

ikumen
  • 11,275
  • 4
  • 41
  • 41