Skip to content

Instantly share code, notes, and snippets.

@drewww
Created June 13, 2010 19:01
Show Gist options
  • Save drewww/436898 to your computer and use it in GitHub Desktop.
Save drewww/436898 to your computer and use it in GitHub Desktop.
import tornado.httpserver
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
function init() {
$.ajax({url:"http://localhost:8888/", success: function(response) {alert("response: " + response);}, method:"GET"});
}
</script>
</head>
<body id="test" onload="init()">
<h1>Tornado/JS Request Testing</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment