Route::get('comptes','BookmakerController@showComptes');
public function showComptes(){
$bookmakers = $this->user->comptes()->with(array('bookmaker'))->get();
return Response::json($bookmakers,200);
}
function loadBookmakersOnDashboard() {
$.ajax({
url: 'comptes',
dataType:'json',
success: function (data) {
alert(data);
},
error: function (data){
console.log('la récuperation des comptes vers le dashboard n\'a pas fonctionné');
}
});
}
i get the right data but it goes to error callback..weird
Network response:
0: {id: 1, created_at: "2015-03-04 19:30:05", updated_at: "2015-03-04 19:30:05", deleted_at: null,…}
1: {id: 2, created_at: "2015-03-04 19:30:05", updated_at: "2015-03-04 19:30:05", deleted_at: null,…}
2: {id: 3, created_at: "2015-03-04 19:30:05", updated_at: "2015-03-04 19:30:05", deleted_at: null,…}
and also it shows
'la récuperation des comptes vers le dashboard n\'a pas fonctionné' from error callback on console.