Fetching data from another page using javascript

Hello there,
I’m building a website with a simple page that shows a list of different projects that you can hover over.
I would like to fetch all the images of the projects you hover over in order to give a “preview” of the page you are going to visit if you click that link. Basically it loads the project informations, images, show the page you are going to visit in a smaller scale (80%, but that’s styling) but hide it as soon as you don’t hover the project title anymore.
I also would like to avoid loading all the images from every project on the main page and show or hide them depending on the project you hover on (it’s easy to get the id and hide or show them with javascript) because I think it will not be very great in terms of performance.

So I thought about fetching data using javascript and ajax.

Is this a great path to follow ? Or maybe loading all of my content and hiding or showing it is better / has no effect on performance ?

Isn’t this a duplicate of Fetching php in javascript?

It could be, even if it’s a more general question - not technical

I’d do it with an Ajax call, although if you lazy-load the images so that they are not loaded upfront, it might not make such a big difference (apart from having all the potentially unneeded HTML in the page).

Thanks here for the tips -
An ajax call seems a bit out of reach for my knowlegde but I’ll try to explore that.