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 ]);
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.
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community