Loading dynamic AJAX content into Fancybox

前端 未结 9 1372
夕颜
夕颜 2020-12-17 22:47

This scenario:

The user inserts his zip into an input-field, and when clicking the magic button, he gets to see stores closest to his location. I ca

9条回答
  •  醉梦人生
    2020-12-17 23:34

    I ended up loading the content into a hidden container on the page, and then displaying that content in a Fancybox.

    $('#button').on('click', function(){    
       var nzData = '/url.com?Zip=8000 #module';
    
         $('#foo').load(nzData, function(){
           var foo = $('#foo').html(); 
           $.fancybox(foo);
        });
    
    });
    

    It's not very pretty, I admit it, but it's the only way I could make it work. I talked to another developer this morning, who had resorted to the same solution in a similar problem.

    Still, there must be a better solution. If anyone know, I'd love to hear it!

提交回复
热议问题