Search
Other Modals questions
Forum

Modal on dynamically generated URL in Ajax callback

Mike Prince's Avatar Mike Prince
I have a URL that I want to open in a modal. The URL however is generated following an Ajax callback. I tried adding
RegularLabs.Modals.init();
in my callback function, based on regularlabs.com/forum/modals/50917-modal...-child-product-pages . However, I then get ReferenceError: RegularLabs is not defined.
How can I get Modals to process such dynamic links?
Peter van Westen's Avatar Peter van Westen ADMIN
You need to make sure Modals is loaded on the page.
Easiest way to do that is make sure there is at least one normal Modals link on the page.
This could be a 'hidden' empty link somewhere, like:
{modal url="whatever"}{/modal}

Otherwise you'll have to somehow make sure the Modals scripts and styles are loaded into the page manually.
Please post a rating at the Joomla! Extensions Directory
Mike Prince's Avatar Mike Prince
Thanks for the prompt response. I got this working after some trial and error: my code was originally of the form
var url = "<a href=\"#\" class=\"modal\">link</a>";
which does not work, however
var url = '<a href="#" class="modal">link</a>';
does.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription