We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
How can I append the ajax property an headers for an X-CSRF-TOKEN?
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); const el = document.getElementById('h5p-container'); const options = { h5pJsonPath: 'h5p-content/true-false-question-34806/', frameJs: 'h5p/frame.bundle.js', frameCss: 'h5p/styles/h5p.css', postUserStatistics: true, ajax: { setFinishedUrl: "{{ route('h5p.finish') }}", // THIS DOES NOT WORK headers: { 'X-CSRF-TOKEN': csrfToken, // Use the fetched CSRF token here '_method': 'patch', }, }, }; new H5PStandalone.H5P(el, options);
For testing this workarround worked for me in Laravel:
<script> $.ajax({ url: "{{ route('h5p.finish') }}", type: 'POST', data: { contentId: 'lykvh3vvf', score: 1, maxScore: 1, opened: 1710971851, finished: 1710971854 }, // THIS WORK headers: { 'X-CSRF-TOKEN': csrfToken, // Use the fetched CSRF token here '_method': 'patch', }, }); </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How can I append the ajax property an headers for an X-CSRF-TOKEN?
For testing this workarround worked for me in Laravel:
The text was updated successfully, but these errors were encountered: