• 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

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

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

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

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

Thanks in advance.