Currently, when configuring QuickTabs to use the ajax loading option, we noticed that the tabs that get loaded by ajax are done so with a POST request, and therefore not cacheable requests. While POST is understandable for certain ajax requests like form submissions, it seems like for the purpose of QuickTabs loading content into tabs, this might be better handled with a GET request. A POST request adds the "no-cache, must-revalidate" headers, preventing these items from getting cached. A GET request does not add the "no-cache" headers and instead respects the page cache settings -- improving performance.

I have a working patch that could use some eyes. It updates quicktabs.js with some code from core's ajax.js (Drupal.ajax.prototype.beforeSerialize) so that we can override core's POST behavior if the current request is to the quicktabs_ajax callback ('/quicktabs/ajax'), and if so sets the options.type to GET.

I'll post a patch shortly :)

CommentFileSizeAuthor
#2 ajax_load_GET_request-2813557-1.patch1.69 KBbtully
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

btully created an issue. See original summary.

btully’s picture

btully’s picture

Patch file above. Let me know what you think.

p.s. I'd also like to format the JS by indenting the code and adding missing semicolons, but can do so in a later patch.

AgentJay’s picture

I love the patch, it does what it says. Before committing it I'd suggest adding an option for get/post for each tab. This is only because get is fantastic for static content, but anything using jQuery or filtered views will be more complicated.