Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Fetch and headers #74

Closed
eydun opened this issue May 19, 2024 · 2 comments
Closed

Question: Fetch and headers #74

eydun opened this issue May 19, 2024 · 2 comments

Comments

@eydun
Copy link
Contributor

eydun commented May 19, 2024

Thanks for this awesome project.

I am using some server-side php-code that checks if the request is made by ajax, by examining if 'X-Requested-With' is set to 'XMLHttpRequest' in headers.

Is it possible to add values to the headers, when using Alpine-Ajax?

@imacrayon
Copy link
Owner

Yes, you can use the x-header directive to set headers per request or the headers key in the global config to set the same header for every request.

Every AJAX request also includes the X-Alpine-Request: true and X-Alpine-Target: {target ids} headers by default.

@eydun
Copy link
Contributor Author

eydun commented May 20, 2024

Thanks! I will look into using the global config setting for this.

@eydun eydun closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants