saluei
1 month ago
293
8
Laravel

get json data in blade

Posted 1 month ago by saluei

I have code like this in controller.php

$Param = ['info1' => 'xxx' , 'info2' => 'xxx','info3' => 'xxx' ];

$ParamData = json_encode($Param);

return redirect()->back()->with('ParamData',$ParamData);

I want to get in *.blade.php file java object but code like this do not work ?????

var strparam='{{ Session::get('ParamData') ?? '0'}}';

var paramobj=JSON.parse(strparam);

alert(paramobj.info1);

Please sign in or create an account to participate in this conversation.