I need to pass a ajax variable as route parameter, but it is showing an error.
This is the error:
Too few arguments to function App\Http\Controllers\PermissaoController::status(), 0 passed and exactly 1 expected
This is the script:
<script type="text/javascript">
$(document).ready(function() {
$('#status_id').change(function(){
var usuario = (location.pathname).split('/');
var status = this.value;
$.ajax({
type: 'get',
url: "",
data: {status: status, usuario: usuario[2]},
dataType:"json",
success:function(html){
$('#projeto_id').find('option').remove();
$('#projeto_id').append('<option value="">Selecione...</option>');
for(var i = 0; i< html.length;i++){
$('#projeto_id').append('<option value="'+html[i]['id']+'">'+html[i]['titulo']+ '-' + html[i]['codigo']+ '</option>');
}
}
})
})
})
This is my function in controller:
public function status($sd) {
$usuario = Usuario::where('id', $sd)->get();
return $usuario;
}
How can I do it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire