Skip to content

Instantly share code, notes, and snippets.

@davydovanton
Created June 1, 2015 21:23
Show Gist options
  • Save davydovanton/e78416dde472fc582092 to your computer and use it in GitHub Desktop.
Save davydovanton/e78416dde472fc582092 to your computer and use it in GitHub Desktop.
Simple sinatra
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
get '/' do
erb :index
end
get '/follower_viz' do
erb :follower
end
__END__
@@ index
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function (){
$(document).on('click', '#send', function () {
$.ajax({
url: "/follower_viz",
dataType: "html",
success: function(data) {
$('#viz').html(data);
}
});
})
});
</script>
</head>
<body>
<button id="send" type="submit" value="Do it!"></button>
<div id="viz" style="margin:20px;border:1px dashed black;height:400px;"></div>
</body>
</html>
@@ follower
<p><%= Time.now %></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment