-
-
Save josevalim/1474331 to your computer and use it in GitHub Desktop.
Code to get a hanging POST request on Windows using WEBRICK.
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> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script> | |
$(function () { | |
$("#myb").click(function () { | |
$.ajax({ | |
url: "/showme", | |
type: "POST", | |
data: {nome: "Jose", sobrenome: "Valim"}, | |
success: function (data) { | |
$("body").append("<p>" + data + "</p>"); | |
} | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<input id="myb" type="button" value="Click me"> | |
</body> | |
</html> |
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
require "sinatra" | |
set :port, 5678 | |
set :views, File.expand_path(".") | |
get "/" do | |
erb :index | |
end | |
post "/showme" do | |
"#{request.env.inspect}\n#{params.inspect}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment