You're returning a view, "test". To return JSON from your controller:
return response()->json($city->jsonArray);
or give it an array directly
return response()->json([
'myData' => $city->field_1
]);
By the way, you can just return the model. Laravel will be output it as json. Is it cool?
Everything is working i just want to know why laravel i showing HTTP status in the json response like this:
Latitude: HTTP/1.0 200 OK Cache-Control: no-cache Content-Type: application/json Date: Sat, 13 Jun 2015 21:27:26 GMT 56.6634447
Instead of : Latitude: 56.6634447
How can i solve this?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community