Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

Build modal content only when modal is opened

$
0
0

To speed loading of a large page of data, I am not loading images. I then list the items (classmate publications). What I want to do is have a modal trigger on each item in the list which will open a modal and pull in all the publication data, including images. But I don't want this text/images in the modal structure within the HTML, which would defeat the whole purpose. Instead, I want to only pull this from the server when the modal is opened. I have been looking at AJAX options, but was wondering if there is a simpler way. I have tried loading=lazy on my images, without much change in load time. (Loading the page with images takes significantly longer than loading it w/o, as one would expect.)I am using javascript (not JQuery) and php, plus basic HTML/CSS.I am open to all sorts of creative solutions.

Calling a php function doesn't change the content of the generated HTML file. I have considered changing the clickable icon (which currently loads the modal) to instead load a php page, but would then have to configure it to appear w/in the modal rather than replacing the existing page.I have seen some answers using Bootstrap Modals, but I am not using Bootstrap.


Viewing all articles
Browse latest Browse all 11661

Trending Articles