O'Reilly logo

Python 3 Web Development Beginner's Guide by Michel Anders

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action getting the time with AJAX

Enter the following code and run it. If you point your web browser to the familiar http://localhost:8080 address, you will see something similar to the picture below with the time changing every five seconds or so. (The code is also available as timer.py)

Time for action getting the time with AJAX

What just happened?

Our small CherryPy application offers just two methods (both highlighted in the code). The index() method returns a minimalistic HTML page with some static text and a small piece of JavaScript that takes care of retrieving the current time from the server. It also features a time() method that simply returns the current time as plain ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required