Unfortunately the question you are making is too open, with more details you will get more help ;)
So the javascript library is going to make ajax call to your application, and your application should respond with json?
In that case, you can just do the routing on config/routes.rb, and then you just write a method like this:
class MyController < ApplicationController
def values_for_js
my_data = MyModel.calculate_data
respond_to do |format|
format.json { render json: my_data.to_json }
end
end
end
And your js should request something like http://mywebsite.com/values_for_js.json (or it can say in the ajax request that a json format is expected). If you are not able to make the json request, you can just use format.js instead of format.json