Answer the question
In order to leave comments, you need to log in
How to get information using ajax requests in laravel?
It is necessary to load information from the database into the modal window using ajax.
I built a structure, but it does not work.
JQ:
function editTask(id){
$.ajax({
url : "/taskContent/",
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
data: {
"id": id
},
type: "POST",
}).done(function( result )
{
$('#mainModalBody').html( result );
});
Route::POST('/taskContent/','[email protected]');
public function taskContent($id){
echo $id;
/*return response()->json(array('foo' => 'bar'));*/
}
<meta name="csrf-token" content="{{ csrf_token() }}">
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question