Skip to content

Instantly share code, notes, and snippets.

@reconbot
Created July 19, 2013 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reconbot/6034285 to your computer and use it in GitHub Desktop.
Save reconbot/6034285 to your computer and use it in GitHub Desktop.
get '/data/:source' do |source|
data = get_data_from_db_or_something(source)
header :content_type, :application_json
data.to_json
end
get '/'
render 'index.html.erb'
end
<html and="shit">
<head>
<script>
// go get jquery and read this http://api.jquery.com/jQuery.ajax/
$.ajax('/data/stuff', {
success: function(data){
$('chart_or_whatever').chart(data);
}
});
</script>
</head>
<body>
<div id="chart_or_whatever"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment