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

Having weird issue with AJAX processing...

Jaxel

Well-known member
#1
I have a form:
Code:
<form action="{xen:link 'rankings/result/edit', $result}" method="post" class="xenForm formOverlay AutoValidator" id="ResultPoster">
As you can see, it is a formOverlay created through "OverlayTrigger". In addition to that,AutoValidates and I am registering it through AJAX using "ResultPoster".
Code:
/** @param {jQuery} $ jQuery Object */
!function($, window, document, _undefined)
{
    XenForo.ResultPoster = function($form)
    {
        $form.bind('AutoValidationComplete', function(e)
        {
            if (e.ajaxData.templateHtml)
            {
                new XenForo.ExtLoader(e.ajaxData, function()
                {
                    $(e.ajaxData.templateHtml).xfInsert('replaceAll', '#eventResults', 'xfShow');
                });
            }
        });
    }
 
    // *********************************************************************
 
    XenForo.register('#ResultPoster', 'XenForo.ResultPoster');
}
(jQuery, this, document);
Its basically the simplest AJAX you can do... when the form successfully validates, it replaces #eventResults with the returned response templateHtml. This is all working correctly. The problem comes with the actual script.

Using the following works:
Code:
if ($this->_noRedirect())
{
    return $this->responseView('EWRtorneo_ViewPublic_EventResults', 'EWRtorneo_EventResults', $viewParams);
}
However, if I use a responseRedirect instead of a responseView, it doesnt work... templateHtml is always undefined.
Code:
if ($this->_noRedirect())
{
    return $this->responseReroute('EWRtorneo_ControllerPublic_Rankings_Event', 'Results');
}
Is there a reason for this? How do I fix?