Allow AJAX to use GET requests

Created on 28 October 2010, about 14 years ago
Updated 15 October 2023, about 1 year ago

Problem summary

AJAX requests are always made using POST, which disables render caching.

However most AJAX requests could be cached safely, and the POST requirement has been due to the large amount of information sent with the request - mainly ajax_page_state containing css/js and html IDs.

ajax_page_state now contains library names instead of individual files, and html IDs are no longer sent at all, resulting in a much shorter URL if requests are switched to GET.

We may be able to reduce the size of the GET request further by compressing ajax_page_state, see 📌 Compress aggregate URL query strings Fixed and 📌 Dynamically determine ajaxPageState based on libraries Active .

Proposed solution

Allow AJAX requests to use GET. Continue to default to POST and make this opt-in for backwards compatibility. Forms will continue to have to use POST because they're forms.

Convert Views AJAX (pagers etc.) to use GET - since this is the primary non-form AJAX use-case in core and validates that everything works.

Follow-ups

📌 Add views render caching on views ajax requests Closed: outdated

📌 Task
Status

Fixed

Version

10.1

Component
Ajax 

Last updated about 17 hours ago

Created by

🇺🇸United States yhahn

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

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

  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

  • JavaScript

    Affects the content, performance, or handling of Javascript.

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.

Production build 0.71.5 2024