Is there any custom code to load popup content with AJAX?

Hi,

If you have a basic popup, whether it’s with AJAX or preloaded, it doesn’t matter.

However, if you have dynamic popups assigned to listing items or as product quick view, then loading content with AJAX is a must have. When you have like 20 listing items / Woo Products per page, it adds a lot of bloat to DOM elements and significantly increases load time.

Has anyone come up with a custom code to trigger Bricks Popups with AJAX?

Thanks

1 Like

Frustrated with this problem!!
@timmse

On one of the pages I have about 50 pop-ups, do not ask why and why you need it.
The page has just loaded, and all the content has already been received.
this is an example page:
Screenshot_10

My solution to the problem. Works, but I would like it to be in Bricks itself

jQuery Modal

Install

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" />

USE in Bricks

Screenshot_6

In the page template
I will not screenshot the conditions for the visibility of the buttons.
Screenshot_1

Each button has the same parameters, except for the link


Screenshot_5

Yes, the button is set.

Now you need to add a modal window and configure
Screenshot_9

Screenshot_12
Screenshot_13

Put something inside the div. This will be the content of Popup

Not really… you just need to use dynamic data in the popup… why would you think it would load 20 popups?

Hi,

I guess you resussected this topic while I just opened a thread with same use case.

How to use dynamic content with in the popup?

The same way you add dynamic data to any bricks elements. You will likely have to do some custom code snippets that get post data from the button that was pressed so you can retrieve custom fields from whatever post the button is related to.

1 Like

So it is with custom code snippets! I’ll test it out!

Thank you @Wingtracer!

they just released some version of this in 1.9.4… havent tried it yet but plan to today. I am JS on the page to call admin ajax method, then update the popup with the response… chatGPT is your friend.