Creating a visualization in Rails with a d3.js JSON callback can be done like this:
View
d3.json(document.URL, function(data){
// create visualization
}
Controller
def index
respond_to do |format|
format.html do
# render the HTML
end
format.json do
# render the JSON
end
end
end
Everything is working well. However, there is an issue when a user returns to the visualization using the browser's "back" button, they see the JSON instead of the HTML.
Do you have any suggestions on how to solve this problem?