November 2018
Beginner
472 pages
13h 5m
English
This template, in templates/control_image_behavior.html, is the same as the one before, but with two important differences, shown here in bold:
<html> <head> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <title>Robot Image Server</title> </head> <body> <h1>Robot Image Server</h1> <img src="{{ url_for('display') }}"><br> <a href="#" onclick="$.get('/control/exit')">Exit</a> </body></html>
In this template, we load a library on the browser called jquery, for which documentation is available at https://api.jquery.com/. This is handy for interactive web pages. We are using it with an anchor tag (the a tag) we saw in the menu earlier, but this has an onclick handler. That handler uses jquery to send '/control/exit' ...
Read now
Unlock full access