vendredi 27 octobre 2017

\HttpException while trying to query the database

I am using this ajax call

        $.ajax({
            url: "",
            type: "post",
            data: {value:value},
            success: function (response) {

                console.log(response);

            },
            error: function(jqXHR, textStatus, errorThrown) {
               console.log(textStatus, errorThrown);
            }
        });

And this is the controller

public function search(Request $request)
    {

        $maskID = 'Mask_' . $request->input('value');

        $result = masks::where('MaskName', 'LIKE', $maskID)->get();

        return $result;

    }

And this is my route: Route::post('/search/mask/byID', 'MaskSearchController@search');

I am getting HTTP 419 in Network tab once the ajax runs, and this is what I see at the response Route::post('/search/mask/byID', 'MaskSearchController@search');

The message is empty so I have NO Idea what could cause this :? I also have

$.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });

and the route is POST, so I don't send POST to GET.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iaujDq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire