Accepted answer

The first parameter of $.getJSON() must be a URL ( So, you can start by putting here a URL that responds to a GET request with an array, or removing this ajax call, and put directly the result of <%= @yearly_complaints.to_json.html_safe %> into a javascript variable (would be in data here).

Related Query