JQuery AJAX вызов в TPL имеет блокировку перекрестного происхождения чтения (CORB) заблокирован перекрестный источник ответа? - PullRequest
0 голосов
/ 24 сентября 2018

JQuery-вызов ajax в tpl имеет блокировку Cross-Origin Read Blocking (CORB), заблокированную в ответе Cross-Origin?Я использовал jsonp dataType и добавил модуль drupa CORS, но это предупреждение появляется в консоли.

$('#video .video_front__block').each(function(index) {
  $.ajax({
    url: $(this).text(),
    type: 'get',
    dataType: 'jsonp',
    error: function() {},
    success: function(data) {
      $('.video_front').hide();
      $('.loader').show();
      // data = JSON.parse(data);
      if (index == 0) {
        $('.video_front__big--item').eq(index).html(
          '<a class="video_front__big--item" href="' + $('#video .video_front__block').eq(index).attr('data-url') + '" >' +
          '<img class="img-fluid video_front__big--img" src="' + data.video.big_poster + '"/>' +
          '<div class="img-fluid video_front__big--title mt-1011 mb-2">' + data.video.title + '</div>' +
          '</a>'
        );
      } else {
        $('#video .video_front__block').eq(index).html(
          '<a class="video_front__block__item justify-content-center align-content-center align-items-center align-content-center mb-1" href="' + $('#video .video_front__block').eq(index).attr('data-url') + '" >' +
          '<img class="video_front__block__item--img img-fluid" src="' + data.video.small_poster + '"/>' +
          '<div class="video_front__block__item--title col-sm-12 col-md-8 align-self-center pr-0 pl-0 pr-md-2 pb-2 ">' + data.video.title + '</div>' +
          '</a>'
        );
        $('#video .video_front__block').eq(0).css('display', 'none');
      }
      $('.loader').hide();
      $('.video_front').show();
    }
  });
});

1 Ответ

0 голосов
/ 24 сентября 2018

добавить расширение Google Moesif CORS и включить его

  1. Дополнительные инструменты
  2. Расширение
  3. Открыть Chrome Web Store
  4. Moesif CORS установить ивключите

или попробуйте с помощью header пропустить cors

...