Hello, I'm getting to know this framework now. I'm trying to send ajax via post and see if it returns something, but it did not work, follow the problem below:
$("#modal-comentario").on("click", function(){
var get_id = $(this).data("obs-id");
$.ajax({
headers: {
'X-CSRF-Token': $('input[name="_token"]').val()
},
url: "{{ URL::to('lista-contatos/update') }}",
type: "POST",
dataType: 'json',
data: {
"id": get_id
},
success: function(result){
alert(result);
}
});
});
ContactController
public function update(Request $request){
echo "teste";
}
Route
Route::post('/lista-contatos/update',
['as' => 'lista-contatos',
'uses' => 'ContatoController@update']);
You are not generating alert(result)
when I click the button.