Skip to content
Browse files

Demonstrate jQuery AJAX callback behavior without content-type in res…

…ponse
  • Loading branch information...
0 parents commit 28bb9c96c29f6b576dfcc803282c492089f90757 @rosenfeld committed May 11, 2012
Showing with 33 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 Gemfile
  3. +10 −0 Gemfile.lock
  4. +2 −0 README.md
  5. +18 −0 config.ru
1 .gitignore
@@ -0,0 +1 @@
+*.sw?
2 Gemfile
@@ -0,0 +1,2 @@
+source "https://rubygems.org"
+gem 'rack'
10 Gemfile.lock
@@ -0,0 +1,10 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ rack (1.4.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rack
2 README.md
@@ -0,0 +1,2 @@
+ bundle
+ rackup -E production
18 config.ru
@@ -0,0 +1,18 @@
+content = %Q{<!DOCTYPE html>
+<html>
+ <head>
+ <title>Example</title>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
+ <script type="text/javascript">
+ $.post('/example', function(){ $('body').append('<p>worked without dataType</p>') })
+ $.post('/example', function(){ $('body').append('<p>worked with explicit dataType</p>') }, 'text')
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
+}
+run Rack::Builder.new {
+ map '/' do run ->(env) { [200, {'Content-type' => 'text/html'}, [content]] } end
+ map '/example' do run ->(env) { [200, {}, ['']] } end
+}

0 comments on commit 28bb9c9

Please sign in to comment.
Something went wrong with that request. Please try again.