Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot call method createDocumentFragment of undefined

I am trying to implement magnific popup

I am having following link <a class="simple-ajax-popup" href="/index.json">load json</a>

When I click the link, lightbox is in loading state and throws an exception as

Uncaught TypeError: Cannot call method 'createDocumentFragment' of undefined

I am using rails 4 and also I have jquery-fileupload plugin but it is working.

like image 786
Prabhakaran Avatar asked Sep 20 '13 03:09

Prabhakaran


1 Answers

Please, read this Documentation: content type

You could not use json as html. You should wrap json to html. What You could do?

Something like this:

$.magnificPopup.open({
  items: {
    src: '<div class="white-popup">Dynamically created popup</div>', // can be a HTML string, jQuery object, or CSS selector
    type: 'inline'
    callbacks: {
      open: function() {
       $.getJSON("/index.json").done(function( data) {
             data.each( function(index, value) {
               $("div.white-popup").append(value);
                       });
              })
       },
      close: function() {
           // Will fire when popup is closed
       }
});

I hope it help.

like image 186
Сергій Назаревич Avatar answered Oct 30 '22 03:10

Сергій Назаревич