Skip to content

Commit 59ba21d

Browse files
committed
Notes, video link, and sample code for session
1 parent 8f07018 commit 59ba21d

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed

session-notes/2015-03-04/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Fundamentals of Web Development
2+
3+
**March 04, 2015**
4+
5+
Video: http://youtu.be/FZMxxDB-8b4
6+
7+
## Workshopping Projects
8+
9+
Working through each student's project concept and plan.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'sinatra'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
rack (1.6.0)
5+
rack-protection (1.5.3)
6+
rack
7+
sinatra (1.4.5)
8+
rack (~> 1.4)
9+
rack-protection (~> 1.4)
10+
tilt (~> 1.3, >= 1.3.4)
11+
tilt (1.4.1)
12+
13+
PLATFORMS
14+
ruby
15+
16+
DEPENDENCIES
17+
sinatra
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
$(document).ready(function() {
2+
$("#send_ajax").on('click', function(event) {
3+
event.preventDefault();
4+
5+
// Send an POST AJAX request to /ajax
6+
$.ajax({
7+
url: '/ajax',
8+
type: 'POST',
9+
dataType: 'json',
10+
data: { name: "John", location: "Boston" }
11+
}).done(function(response) {
12+
console.log(response);
13+
});
14+
});
15+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'sinatra'
2+
require 'json'
3+
4+
get '/' do
5+
erb :index
6+
end
7+
8+
post '/ajax' do
9+
puts "I'm in /ajax"
10+
puts params
11+
12+
{
13+
number: 1,
14+
color: 'green'
15+
}.to_json
16+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<html>
2+
<head>
3+
<title>AJAX example</title>
4+
</head>
5+
<body>
6+
<button id="send_ajax">Send AJAX</button>
7+
8+
<script src="https://code.jquery.com/jquery-2.1.3.js"></script>
9+
<script src="ajax.js"></script>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)