Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from flask import Flask, render_template, request, redirect, Response
- import random, json
- app = Flask(__name__)
- @app.route('/')
- def output():
- # serve index template
- return render_template('ui.html', name='Test')
- @app.route('/receiver', methods = ['POST'])
- def worker():
- # read json + reply
- data = request.get_json()
- result = ''
- for item in data:
- # loop over every row
- result += str(item['make']) + '\n'
- return result
- if __name__ == '__main__':
- # run!
- app.run(debug=True)
- ---------------------------------
- ui.html:
- <script static="static/tabletoggle.js.download"></script>
- <div class="limiter">
- <div class="container">
- <div class="row text-center navpad">
- <div class="col">
- <button type="button" class="btn btn-outline-primary" id="6hrtog">6 Hour View</button>
- </div>
- <div class="col">
- <button type="button" class="btn btn-outline-primary" id="12hrtog">12 Hour View</button>
- </div>
- <div class="col">
- <button type="button" class="btn btn-outline-primary" id="24hrtog">24 Hour View</button>
- </div>
- <div class="col">
- <button type="button" class="btn btn-outline-danger">Admin Panel</button>
- </div>
- </div>
- </div>
- <div class="container-table100" id="6hr" style="display: none;">
- <div class="wrap-table100">
- <div class="table100 ver1 m-b-110">
- <div class="table100-head">
- <table>
- <thead>
- <tr class="row100 head">
- <th class="cell100 column1">I'm</th>
- <th class="cell100 column2">the</th>
- <th class="cell100 column3">6</th>
- <th class="cell100 column4">hour</th>
- <th class="cell100 column5">table</th>
- </tr>
- </thead>
- </table>
- </div>
- -----------------------
- in the tabletoggle.js
- $(function() {
- $('#6hrtog').click(function() {
- $('#6hr').show();
- $('#12hr').hide();
- $('#24hr').hide();
- });
- $('#12hrtog').click(function() {
- $('#6hr').hide();
- $('#12hr').show();
- $('#24hr').hide();
- });
- $('#24hrtog').click(function() {
- $('#6hr').hide();
- $('#12hr').hide();
- $('#24hr').show();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement