1

i try open with fancy box iframe with content of product page without header, sidebar and other.

There is my link

<a rel="example_group" class="fancy_view" data-id="{$product_info[11]}" data-href="{$product_info[13]}" href="#fancy_popup">Увеличить</span></a>

and this is jquery

$( ".fancy_view" ).click(function () {
    var id = $(this).data('id');
    var link = $(this).data('href');
    $.ajax({
            type: "POST",
            url: link,
            data: "id=" + id + "&ajax=1",
            success: function(result){
                $.fancybox(result, {
                    'type'  : 'iframe',
                    'width' : 600,
                    'height': 500
                });

            },
        });
    return false;
});

in console i see response with content, but in iframe - 404 error. where is my mistake?

2 Answers2

0

Add beforeLoad with your link variable like following

        success: function(result){
            $.fancybox(result, {
                'type'  : 'iframe',
                'width' : 600,
                'height': 500,
                beforeLoad : function(){
                this.href = link
               }
            });
          }

Reference Link

Community
  • 1
  • 1
Sadikhasan
  • 18,365
  • 21
  • 80
  • 122
0

http://jsfiddle.net/v7nbLuzr/

$.fancybox({
  'content'  : result,
  'width' : 600,
  'height': 500
});

try it

waki
  • 1,248
  • 2
  • 17
  • 27