Support the ongoing development of Laravel.io →
Requests Input
Last updated 2 years ago.
0

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
 ]);
0

aaah i see!

Than you! that worked!:)

0

By the way, you can just return the model. Laravel will be output it as json. Is it cool?

0

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?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

spoofy spoofy Joined 27 Apr 2015

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.