I'm trying to query a restful webservice written in laravel using $.getJSON (jquery). But the cross origin request is blocked.
This is what I've in larvel:
Route::get("/fakedata", function(){
$utenti = [];
for($i=0; $i<100; $i++){
$utenti[$i] = new \stdClass();
$utenti[$i]->nome = "nomeutente".$i;
$utenti[$i]->cognome = "cognome".$i;
$utenti[$i]->indirizzo = "indirizzo".$i;
$utenti[$i]->telefono = "telefono".$i;
}
return Response::json(["utenti"=>$utenti])->setCallback(Input::get('callback'));
});
In js:
$.getJSON("http://mysite/fakedata")
solved using:
$.getJSON("http://mysite/fakedata?callback=?")
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community