Home Getting undefined value while returning json value from controller
 Here I want to get all the values which I inserted into the json data in a table before getting submitted but unfortunately am not getting the results I want. So far I have done this. Please have a look.   Here I want to pass the values of json_data in to the table i had written and how can we pass that here am getting error like undefined. Here is my controller public function ajax_data() { $array = array("agent_name" =>$_POST['agent_name'],"number"=>$_POST['number'],"type"=>$_POST['type'],"quantity"=>$_POST['quantity'],"date"=>$_POST['date'],"commision"=>$_POST['commision'],"profit"=>$_POST['profit'],"agent_amount"=>$_POST['agent_amount'],"user_id"=>$_POST['user_id']); $data['json'] =$array; echo json_encode(\$data); }  here is my json_data which looks like this {"json":{"agent_name":"admin","number":"444","type":"super","quantity":"4","date":"2018-02-14 15:16:27","commision":"10.00","profit":"40.00","agent_amount":"0.00","user_id":"1"}}