문제

I am using $.getJSON to load in a video gallery from Vimeo and it works fine in all browsers, except in any version of IE. I cannot figure out what I am doing wrong.

Here is the .js file where the getJSON is running:

console.log('file load');

var jsonURL = 'http://vimeo.com/api/v2/album/1822727/videos.json';

$.getJSON(jsonURL, function(data){
  $.each(data, function (index, value) {
    var videoID = value.id;
    var videoThm = value.thumbnail_large;
    $('#galThms').prepend('<li id="thm' + videoID + '" style="background-image:url(' + videoThm + ');"><a title="' + videoID + '" href="#playVideo"></a></li>');
    console.log('json success');
    });
    $(function() {
      $('.galleryThms a').click(function() {
        $('#loadVideo').slideDown();
        $('.galleryThms a').html('');
        $(this).html('<div class="currentOverlay"><ul><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul></div>');
        $('<div class="watchedVideo"></div>').appendTo($(this).parent());
        $('.galleryThms a').css('background-image', 'url(/images/gallery-play-button.png)');
        $(this).css('background-image', 'none');

        //Embed Video
        var vimeoEmbedID = $(this).attr( "title" );
        $('#loadVideo').html('<iframe src="//player.vimeo.com/video/' + vimeoEmbedID + '?title=0&amp;byline=0&amp;portrait=0&amp;color=57bec7&amp;autoplay=1" width="1920" height="1080" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');

     });

  });
 });

The live example can be found here: http://wavesmediagroup.com/weddings/portfolio/

도움이 되었습니까?

해결책

It was a cross domain issue. This article here, http://e-mats.org/2010/01/jquery-getjson-and-the-same-origin-policy, explains in detail that you simply add:

?callback=?

…at the end of your cross domain JSON file, and jquery handles the rest. So my URL now looks like:

http://vimeo.com/api/v2/album/1822727/videos.json?callback=?

…and it works perfectly!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top