<!DOCTYPE html>
<html>
    <body>
        <h1>Mootools test page</h1>
        <ul id="list">
            <li>first item</li>
        </ul>
        <p><a href="items.json" id="button">Update list</a></p>
        <script src="{{ url_for('static', filename='mootools.js') }}" type="text/javascript"></script>
        <script type="text/javascript">
            var list = document.id('list');
            var button = document.id('button');
            button.addEvent('click', function(e) {
                var r = new Request.JSON({url: button.get('href'), onSuccess: function(datas) {
                    datas.items.each(function(item) {
                        list.adopt(new Element('li', {
                            text: item
                        }));
                    });
                }}).get();
                e.stop();
            });
        </script>
    </body>
</html>