What I'm trying to do is a function in javascript that sends a simple data to a laravel controller and then upload it to the database, the problem I have is that until now I could not find a way to send that data, I always get error 500.
controller in laravel:
public function crearRegistro(Request $request){
$registro = new Registro();
$registro->indicador = $request->indicador;
$registro->save();
}
Function in Javascript:
$scope.calculoIndicador = function(){
$http.post("/calculoIndicador")
.then(function(response) {
});
$scope.indicador = 5 +5;
alert('Se ha guardado correctamente');
}
I am using the javascript function with a button in the view.
<input class="btn btn-success" style="" ng-click="calculoIndicador()"
type="submit" value="Enviar"/>
And I also have everything ready on the route