I want to pass data from my Controller to a JavaScript that handles a Google Bar Chart.
composer
$tmp = 6;
return view('pages.template', ['tmp' => $tmp]);
from my template.blade.php
I call the Google Chart
<div id="chart_div"></div>
.js file:
var tmp = 6;
var tmp2 = parseInt('{!! $tmp !!}');
var data = google.visualization.arrayToDataTable([
['comment1', 'comment2'],
["- 6 days", tmp],
["- 5 days", tmp2],
["- 4 days", 31],
["- 3 days", 12],
["- 2 days", 10],
["- 1 day", 3],
["today", 4]
the 2nd bar from Google-Bar-Chart is blank ....
But there should be displayed my variable.
How do I solve this issue?