Google地理编码从Controller到Javascript的响应

I'm working on a Laravel 5.1 project and use "alexpechkarev/google-geocoder": "dev-master" which works perfectly.

A little issue comes in when I'm trying to print out the map with Javascript. I get this response in my controller:

$param = array(
                    "address"=> $detail->address,
                    "components"=>"country:NG"
                    );

                $response = \Geocoder::geocode('json', $param);

                echo "<pre>", print_r($response), "</pre>";

And I get this response:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Nigeria",
               "short_name" : "NG",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Nigeria",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 13.8856449,
                  "lng" : 14.677982
               },
               "southwest" : {
                  "lat" : 4.2464428,
                  "lng" : 2.676932
               }
            },
            "location" : {
               "lat" : 9.081999,
               "lng" : 8.675276999999999
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 13.8856449,
                  "lng" : 14.677982
               },
               "southwest" : {
                  "lat" : 4.2464428,
                  "lng" : 2.676932
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJDY2kfa8LThARyAvFaEH-qJk",
         "types" : [ "country", "political" ]
      }
   ],
   "status" : "OK"
}
1

My question is, how to get this response from controller to Javascript and pass it to the map.

Something like this:

$('#map_canvas').gmap3({
            marker:{
                address: '40.717599,-74.005136' 
            },
            map:{
                options:{
                    zoom: 17,
                    scrollwheel: false,
                    streetViewControl : true
                }
            }
        });

Thanks.