I have mistake with firebug : "500 (Internal Server Error)".
I begin with Ajax and I would like understand a simply thing:
$("#boutonRecherche").click(function () {
$.ajax({
url : "/recherche", //I have tried rechercheController.php and ...
//...Http/Controllers/Phases/RechercheController.php
type : "POST",
data : '&controle=1',//after comments I found this lines triggers error in
//...firebug
dataType : "html"
});
});
What is the best path for the url ?
How to fix "500 (Internal Server Error)"
View code:
{!! Form::open(['url'=>'recherche']) !!}
{!! Form::submit('solaire',['class'=>'btn btn-primary', 'name'=>'recherche',
'id'=>'boutonRecherche']) !!}
{!! Form::close() !!}
My paths :
My Controller Http/Controllers/Phases/RechercheController.php
My View public/resources/views/phases/recherche.blade.php
My JS dans public/script.js
Thanks in advance ;)
POST request needs CSRF token
.
When you are sending form, add to data
object in AJAX field {_token: csrfToken}
.
The csrfToken
you can parse from form or from <head>
where you create <meta name="csrf_token" content="{{csrf_token()}}">
field.
If you want to send GET param, append it to url, so url : "/recherche?controle=1"