• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Trigger XF jQuery functions for AJAX loaded HTML

#1
Hi, I'm trying to get the box that appear when an username is clicked for some links I'm getting via AJAX, the problem is that the links don't work because the event handlers are not appended to the stuff loaded via AJAX, I took a look to the XF code and I found this in the xenforo.js file

Code:
    // Register overlay-loading controls
    // TODO: when we have a global click handler, change this to use rel="Overlay" instead of class="OverlayTrigger"
    XenForo.register(
        'a.OverlayTrigger, input.OverlayTrigger, button.OverlayTrigger, label.OverlayTrigger, a.username, a.avatar',
        'XenForo.OverlayTrigger'
    );
and

Code:
        /**
        * Begins the process of loading and showing an overlay
        *
        * @param event e
        */
        show: function(e)
        {
            var parentOverlay = this.$trigger.closest('.xenOverlay').data('overlay'),
                cache,
                options,
                isUserLink = (this.$trigger.is('.username, .avatar')),
                cardHref;
But I dont know how to trigger this function using for example something like this:

Code:
    $(document).on('click', '.username' ,function (e) {
        //Trigger the Xenforo event.
    });
So I can use the username box for AJAX loaded links.

Thanks in advance.