Answer the question
In order to leave comments, you need to log in
Laravel. How to embed csrf token in html file?
Hi all.
I implemented it as follows:
Main menu | Task List | Place for task editing form
A......................|Task 1.........|
B.....................|Task 2.........|
When you select item A of the main menu, the Tasks view is loaded in which a list of tasks is formed using the array passed to it and there is an empty div for the form.
When a task is selected in column #3, a form for editing the task via AJAX is displayed (the form is in a separate file, it is read, something is edited through the template engine and embedded in a div using Jquery $("#id")). In order for the completed task to leave the list, I decided to send the form in the usual way using the link /my_site/menu_A, where the list of tasks already without completed ones will be re-formed, etc.
Laravel doesn't accept form without csrf token. In the blade.php views, the issue is simple, but how do I inject the token into a form that is dynamically generated and shown via AJAX ?
Andrei.
Answer the question
In order to leave comments, you need to log in
0) Ubuna had a diagnostic utility
1) Examine the system logs: /var/log/*.
2) Parse dmesg -l err,warn
3) Observe output of vmstat 1, tail -f /var/log/syslog, /var/log/Xorg.0.log until hang
Insert the token in the meta tag
<meta name="csrf-token" content="{{ csrf_token() }}">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question