Created
July 19, 2013 00:49
-
-
Save reconbot/6034285 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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