Support the ongoing development of Laravel.io →
Eloquent Views

Hello, How to return Json Data from function in controller to view Here is function

public function getLoginDetails($dIdLogin)
	{
		$dIdAgent = \Authorize::getCurrentAgent();
		$oCheck = UserAgent::where('id_user', '=', $dIdAgent)
			->where('id_mt4_user', '=', $dIdLogin)
			->first();

		if ($oCheck) {
			$oMt4Login = Mt4User::where('LOGIN', '=', $dIdLogin)->first();
			$aResult = array(
				'LOGIN'			=> $oMt4Login->LOGIN,
				'GROUP'			=> $oMt4Login->GROUP,
				'NAME'			=> $oMt4Login->NAME,
				'COUNTRY'		=> $oMt4Login->COUNTRY,
				'CITY'			=> $oMt4Login->CITY,
			
			
			);
			return JsonResponse::create($aResult);

		} 


Thanks

Last updated 3 years ago.
0
return Response::json($aResult);
0

Thanks micanzhang but how to show this in view ex show in table

0

do you want login via ajax request? or you just want echo json format to html? i don't get it, or ?

return Response::make('view', ['data'=>json_encode($aResult)]):
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.

© 2025 Laravel.io - All rights reserved.