0
votes

I am using Ruby on Rails and trying to call a partial named _bmetric by using render_async in the index method. This partial has html code and also a highcharts (js). The problem is that the highcharts does not show up. However, if I use render instead of rander_async, there is no problem.

Can someone please tell me what should I consider while using render_async to call a partial with highcharts?

1
Hi @bhp, Do you have any errors in browser console (Developer Tools)?ppotaczek

1 Answers

1
votes

Check out this answer https://stackoverflow.com/a/52842726/4158895

It should help you with your problem.

When you try to render a nested partial, render_async loads JS code inside a script tag that needs to be evaluated to do another request. jQuery has a powerfull method .replaceWith(text) which evaluates any script tags in the text variable. This is not so easy to achieve in plain JS. I'm trying to come up with a solution for this.