0

In this line of the apostrophe-templates module it states that a jquery get call will set the req.xhr and as a result the refreshLayout.html template will be used, which means you don't get the entire page.

However this seems restrictive and we need a way to override it, because what if I actually just wanted the entire page for say animation purposes, or crawling purposes using jquery?

Fotis Paraskevopoulos
  • 1,001
  • 2
  • 12
  • 19

1 Answers1

1

As you know I am the lead developer of Apostrophe at P'unk Avenue.

It's easy to change the AJAX behavior. Just use a pageBeforeSend handler in any module to set a property in req.data and, in your refreshLayout.html, use that as the argument to extend.

// in any module
self.pageBeforeSend = function(req) {
  req.data.ajaxLayout = 'modulename:layoutname.html';
};

// in your refreshLayout.html
{% extend data.ajaxLayout %}

This is the same technique that allows your page templates or inner layout to extend either the outer layout or the ajax layout.

Tom Boutell
  • 7,281
  • 1
  • 26
  • 23