Ajax click loads tab with POST vs GET request, preventing use of cache

Created on 7 October 2016, over 8 years ago
Updated 16 December 2024, about 1 month ago

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 :)

✨ Feature request
Status

Closed: outdated

Version

3.6

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States btully Dutchess County, NY

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    With D7 EOL approaching in a month I'm starting to triage the D7 side of quicktabs queue.

    If still an issue or needed for 4.0.x (latest branch) feel free to reopen

Production build 0.71.5 2024