Support the ongoing development of →
Requests Input
Last updated 10 months ago.

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

aaah i see!

Than you! that worked!:)


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!

Full Stack Europe

Your banner here too?

spoofy spoofy Joined 27 Apr 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.