S
S
Stacy None2019-05-10 18:02:52
JavaScript
Stacy None, 2019-05-10 18:02:52

How to load only certain div in magnific popup in ajax request?

There is such a window plugin.
I want to call a window and load content into it starting from a certain div on the Internet they write about some kind of ?tmpl=component

<a class="simple-ajax-popup" href="https://vipadmin.club/o-proekte.html?tmpl=component">Загрузить страницу в мод. окне Ajax</a>

But it doesn’t work for me, not only the content with the div is loaded, but the entire page with the menu, etc.
They write like this “To show only the content, discarding unnecessary blocks (site header, sidebar, footer, etc.) I will add to end address parameter - ?tmpl=component." What is this parameter?
How to set up this request correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel, 2019-05-10
@Stacy11

Do you have Joomla? It looks like ?tmpl=component is related to this CMS, and somehow formats the output of CMS information, which can later be used for a popup window, as an option.
It seems to be written here:
https://boxapp.net/blog/joomla/ispolzovanie-tmpl-c...
PS For Magento, ?tmpl=component is not relevant at all.
If you need to load some div on the site into the popup window, use the standard config https://dimsemenov.com/plugins/magnific-popup/docu...
Load a specific element from another page:
We use callback in the call:

$('.open-popup-link').magnificPopup({
  type:'ajax',
  callbacks: {
  parseAjax: function(mfpResponse) {
    mfpResponse.data = $(mfpResponse.data).find('#какой-то элемент');
  }
}
});

If the element has no direct parents, change find to filter:
$('.open-popup-link').magnificPopup({
  type:'ajax',
  callbacks: {
  parseAjax: function(mfpResponse) {
    mfpResponse.data = $(mfpResponse.data).filter('#какой-то элемент');
  }
}
});

I
imdeveloper, 2019-05-10
@link_web

tmpl=component- this is a feature of Joomla and has nothing to do with the pop-up plugin. The fact is that when passing this parameter to Joomla, the CMS will issue only the content part without the rest of the blocks - more here.
Accordingly, this will not work for you (unless you have Joomla). A different approach is needed here. For example, as an option, starting from the popup path (based on the popup selector, so that it would not affect the main site) hide / remove unnecessary elements (header, footer) or create pages separately without a header and footer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question