TokenMismatchException in VerifyCsrfToken.php line 67 on laravel using ajax
<p>This view has a link which calls a javascript function</p>

<pre><code>@extends('layouts.main')

@section('content')
    &lt;table class="table"&gt;
        &lt;tr&gt;
            &lt;th&gt;ID&lt;/th&gt;
            &lt;th&gt;Nombre&lt;/th&gt;
            &lt;th&gt;Opción&lt;/th&gt;
        &lt;/tr&gt;
    @foreach ($tasks as $task)
        &lt;tr&gt;
          &lt;td&gt;{{$task-&gt;id}}&lt;/td&gt;
            &lt;td&gt;{{$task-&gt;name}}&lt;/td&gt;
            &lt;td&gt;&lt;a href="javascript:void(0)" onclick="eliminar({{$task-&gt;id}})" class="btn btn-danger"&gt;Eliminar&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;
    @endforeach
    &lt;/table&gt;
@stop
</code></pre>

<p>and here is the javascript code</p>

<pre><code>function eliminar(id){
  $.ajax({

           type: "DELETE",
           url: "task/"+id,
           success: function (data) {
               console.log(data);
           },
           error: function (data) {
               alert('Error:', data);
           }
    });
}
</code></pre>

<p>and with the ajax call i want to call the destroy method of my controller</p>

<pre><code>&lt;?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Task;

class TaskController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $tasks = Task::all();
        return view('mainview',['tasks' =&gt; $tasks]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        return "destroy";
    }
}
</code></pre>

<p>But when I click the links  I get this error :</p>

<blockquote>
  <p>TokenMismatchException in VerifyCsrfToken.php line 67</p>
</blockquote>

<p>I'm new on Laravel but I thought that csrf was for forms.</p>