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

XF 1.5 AJAX works but isn't putting out header or breadcrumbs

Discussion in 'Styling and Customization Questions' started by SkyeLogic, Aug 31, 2016.

  1. SkyeLogic

    SkyeLogic Member

    I am using AJAX on my site and it's working. Whenever you click a link, the site loads with the new content. The new content, however, isn't the full content and only partial. The new content doesn't include the header or breadcrumbs. Here is my code:
    Code:
    //* @param {jQuery} $ jQuery Object */
    !function($, window, document, _undefined)
    {
        XenForo.ContentLoader = function($link)
        {
            $link.click(function(e)
            {
                e.preventDefault();
            
                XenForo.ajax(
                    $link.attr('href'),
                    {},
                    function(ajaxData, textStatus)
                    {
                        if (ajaxData.templateHtml)
                        {
                            new XenForo.ExtLoader(ajaxData, function()
                            {
                            $(ajaxData.templateHtml).xfInsert('replaceAll', $link.data('target'));
                            });
                        }
                    }
                );
            });
        }
    
            // *****************************************************************
            
            XenForo.register('a.ContentLoader', 'XenForo.ContentLoader');
    }
    (jQuery, this, document);
    Whenever you click a link with class="ContentLoader" data-target="#whatever", the new content loads wherever specified with id="whatever"

    I would like the code to be loaded like this:
    http://ourworldfm.com/v2/pages/about/

    Now click about us at the bottom of the page. You will see the template is being stripped of breadcrumbs and header. WHY?! Anyone please help.
     
  2. Mike

    Mike XenForo Developer Staff Member

    You'll need to consider taking a different approach. We never return any of the "container" data with Ajax/JSON requests.
     
  3. CyberAP

    CyberAP Well-Known Member

    Use jQuery ajax method instead, it provides you with full page HTML.
     

Share This Page