M
M
MaksimLav2018-11-13 11:43:23
JavaScript
MaksimLav, 2018-11-13 11:43:23

How to load only part of html via ajax in fancybox 3?

There is an html file that contains blocks with pictures:

<html>
<head></head>
    <body>
    <img src="img/alie-parusa-bg-1.jpg" alt="" id="one">
    <img src="img/construction-phase-bg-1.png" alt="" id="two">
    <img src="img/img-for-slider-1.jpg" alt="" id="three">
    </body>
</html>

There is a button that says to download part of this html (#one).
<a" data-type="ajax" data-src="plan-floor-pop-up.html #one" data-filter="#one" data-fancybox href="javascript:;" class="fancybox.ajax select-apartment-table-section__floor-block">

fancybox 3 supports ajax document loading, but it loads the whole document (developer example https://codepen.io/fancyapps/pen/jvgRRe?editors=1100 ) and not part of it via id. Tell me, is it possible to download exactly the specified piece?
Because, even asynchronously, it loads all the pictures
5bea8e67df901377403344.png5bea8e80cd3b1011409002.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Neverov, 2018-11-13
@MaximLav

Through AJAX, only the entire document is loaded from and to. This is technically impossible. Be it html, text, xml or json.
Usually they use, for example, get or post requests to get only certain data, and not all at once. You can try to get dirty in the backend and set up your own bridge, which will take data from the final site, filter it and give your script only what it needs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question