dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

Uncaught TypeError: Cannot read property 'parsed' of undefined #1108

Open SurferJoe opened 5 years ago

SurferJoe commented 5 years ago

I should preface that I'm accessing Magnific-Popup from within the Divi Wordpress theme so there maybe things out of our control. I'm trying to open a link using the ajax type but it fails giving the error "Uncaught TypeError: Cannot read property 'parsed' of undefined". The documentation seems very straight forward and link does in fact work. I have added an example of what I'm trying to do below along with the output from the console. Magnific-Popup resides inside of custom.min.js and my script is running from scripts.js. The script fails with or without the callback or adding ajax options. Maybe someone can spot my mistake process quickly. Thank you for any insights.

Console Error

Uncaught TypeError: Cannot read property 'parsed' of undefined
    at t.updateItemHTML (custom.min.js?ver=3.19.10:43)
    at t.open (custom.min.js?ver=3.19.10:43)
    at Object.open (custom.min.js?ver=3.19.10:43)
    at HTMLAnchorElement.<anonymous> (scripts.js?ver=5.0.3:72)
    at HTMLAnchorElement.dispatch (jquery.js?ver=1.12.4:3)
    at HTMLAnchorElement.r.handle (jquery.js?ver=1.12.4:3)
<a class="popup" href="https://www.domain.com/perma-link/" >Click for Details</a>
<script>
jQuery(document).ready(function($) {
    jQuery('.popup').click(function(e) {
        e.preventDefault();
        jQuery.magnificPopup.open({
            type: 'ajax',
            callbacks: {
                parseAjax: function(mfpResponse) {
                    mfpResponse.data = $(mfpResponse.data).find('.et_pb_text_inner');
                }
            }
        });
    });
});
</script>
rheng001 commented 5 years ago

@SurferJoe Did you ever resolve this issue? Having the same problem as well.