🚀 Feature request: Add Ability to set headers with send_ajax_response #4973
Closed
DONEILL-emp
started this conversation in
Feature Requests
Replies: 3 comments
-
|
I have created a PR for this: #4983 My setup is heavily reliant on Ajax responses so I would be very grateful if this could be considered, thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@intoeetive I just wanted to give this a bump in case it was not seen. Any thoughts on if this could be added pls? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Shipped in 7.5.18 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Suggest an idea for ExpressionEngine
Is your feature request related to a problem? Please describe.
When we want to return a response as an Ajax response there is no way to set any headers.
Describe the solution you'd like
In the
_displayfunction there is a block of code that handles this:It would be great if that logic was copied into the
send_ajax_responsejust before the json_encode call.This would give the ability to set values for a caching layer that sits in front of the responses, like so
Cache-Control is just my particular use case, but this could be used for setting custom headers to pass all kinds off info back. The nice thing is, in our custom add-ons we can set what values we please and the function will just loop over and set them.
Teachability, Documentation, Adoption, Migration Strategy
We could update https://docs.expressionengine.com/latest/development/legacy/libraries/output.html#send_ajax_responsemsg-statuscode--false so that the first example could show an example of
set_headergetting used before the actualsend_ajax_responsecall.Beta Was this translation helpful? Give feedback.
All reactions