0

I added a graph partial and called this method of Chartkick to load the graphs, it works fine with HTML request. When i call it with Ajax. i always see LOADING error. any idea what could be the reason of this ?

   = pie_chart Goal.group(:name).count

I'm using Rails 4.1.9 and ruby ruby 2.1.5

  • i even tried this http://stackoverflow.com/questions/19144640/using-chartkick-in-rails-4-0 but it still not working – user2261694 Apr 29 '15 at 07:38
  • I'd suggest sharing your Ajax code and checking in browser devtools and logs to see if there's any difference between the Ajax call and the direct request. Particularly look at the request "accept" header. It's also not clear from your question if the content is actually landing in the browser (but not being rendered due to a JS error) or broken on the server, so devtools+logs should help with that. – mahemoff Apr 29 '15 at 08:05
  • 1
    i called $("body").append('#{escape_javascript(yield :charts_js)}'); and it solves the problem, thanks mahemoff – user2261694 Apr 29 '15 at 10:15

0 Answers0