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

More of a wild guess because I have not yet has cause to return a response directly in my routes file but should your controller not be returning a JSON encoded response? Maybe the routes file will auto encode the response?

For example;

$var = App\Core\PictureProject\ppPersons::where('pp_person_id', '=', $input)->get();
return \Response::json(['status' => 'true','result' => $var ]);
Last updated 9 years ago.
0

jacksoncharles said:

More of a wild guess because I have not yet has cause to return a response directly in my routes file but should your controller not be returning a JSON encoded response? Maybe the routes file will auto encode the response?

For example;

$var = App\Core\PictureProject\ppPersons::where('pp_person_id', '=', $input)->get(); return \Response::json(['status' => 'true','result' => $var ]);

That does not appear to be doing it for me. I tried all of the following, none worked.

return \Response::json(['status' => 'true','result' => $var ]);
return Response::json(['status' => 'true','result' => $var ]);
return \Response::json($var);
return Response::json($var);

The error I get from the jquery ajax error report is just "Internal Server Error".

clearly I'm still way new to jquery and laravel, so I have no idea what I'm doing wrong.

0

SUCCESS,

I found the log files, and I found an error saying the Class Input wasn't found.

So I changed my controller to this.

 public function dropdown() {
      $input = \Input::get('index');
      return \App\Core\PictureProject\ppPersons::where('pp_person_id', '=', $input)->get();
   }

And now I all is working. I guess since I have my controller in a sub-directory, it was not getting the right environment/namespace.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Nertskull nertskull Joined 3 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.