How to pass data to popup correctly?

Hey all! :slight_smile:

I am working on my first large WordPress Website with Bricks. I am doing something very custom and a bit “artsy,” if you will.

I feature 130 buttons on my main page. Those buttons are created via a query loop. On clicking on each of those buttons, I open a Popup with a query loop inside that fills a Nestable Tab to show simple text info.

Structure:
Main page → Query Loop creates Buttons → OnClick on Button opens a Popup Template → Query Loop fills Nestable Tab on Popup

All this is functional already, but I kinda hit a wall now. I need to pass a value (a text string like “1992”) from the button to the Popup to set the title on the Popup and to filter the tabs on the Popup.

How would I do this the right way? I experimented a bit with putting a “Template” component into the Query Loop for the Buttons and enabling AJAX on the Popup, but then my page loads unusably slowly. (at least that’s my interpretation)

I don’t really understand what’s going on behind the scenes here. I just need a reference to the button name that opens up the Popup, but I am so very new to WordPress that I don’t have a good understanding of best practices yet.

Help would be much appreciated! <3