carpfede
145
12
General

How can add CSRF token in axios post?

Posted 3 months ago by carpfede

Hi, Server rejects my request because not contains CSRF token but I have not a tag for include it:

<select class="form-control form-control-sm" onChange="updateTask({{$task->id}},this.value)">
</select>

<script>
    function updateTask (id,item) {
        const dto = {
            'taskId': id,
            'status': item,
        }
        axios.post('/tasks/update',dto).then();
    }
</script>

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.