I want to load a JSON data in RoR 4 to graphic the data using Highcharts.
I have in index.html.erb
{<h1 style="text-align:center" >HighCharts Test</h1>
<h1>Start</h1>
<div id="container" style="width:100%;height:400px;"></div>
<script>
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
type: 'spline'
},
series: [{}]
};
$.getJSON('data.json', function(data) {
options.series[0].data = data;
var chart = new Highcharts.Chart(options);
});
});
</script>
<h1>End</h1>}
The data.json is in the same folder as index.html.erb.
However, it is not plotting anything when i run the code. Im very new to RoR and Highcharts. Whats the error? Thank you.