Triggering a modal without using AJAX

Jake B.

Well-known member
I have a modal that I want to display on a page, and I want it to be styled like any other modal in XenForo (member card, etc). However, I do not want the content to be loaded from another URL (so no creating a controller that outputs modal content and triggering a click on an OverlayTrigger to open this)

I need to be able to display it using JavaScript after a specific action has been completed, what is the best way to do this?
 
Code:
XenForo.createOverlay(null, $(''
    + '<div class="xenOverlay">'
    +   '<div class="section">'
    +      '<a class="close OverlayCloser"></a>'
    +      '<h2 class="heading">Ay Jake!</h2>'
    +      '<div class="baseHtml">Sup?</div>'
    +   '</div>'
    + '</div>'
)).load();
 
I believe I opened a modal without using Ajax in my Post Templates addon. You may want to look through the code. I can't atm unfortunately.
Code:
XenForo.createOverlay(null, $(''
    + '<div class="xenOverlay">'
    +   '<div class="section">'
    +      '<a class="close OverlayCloser"></a>'
    +      '<h2 class="heading">Ay Jake!</h2>'
    +      '<div class="baseHtml">Sup?</div>'
    +   '</div>'
    + '</div>'
)).load();

I'll have to give both of these a try once I get back to that project. Thanks!
 
Top Bottom