Advertisement
Guest User

Untitled

a guest
Feb 7th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. import sys
  2.  
  3. from flask import Flask, render_template, request, redirect, Response
  4. import random, json
  5.  
  6. app = Flask(__name__)
  7.  
  8. @app.route('/')
  9. def output():
  10. # serve index template
  11. return render_template('ui.html', name='Test')
  12.  
  13. @app.route('/receiver', methods = ['POST'])
  14. def worker():
  15. # read json + reply
  16. data = request.get_json()
  17. result = ''
  18.  
  19. for item in data:
  20. # loop over every row
  21. result += str(item['make']) + '\n'
  22.  
  23. return result
  24.  
  25. if __name__ == '__main__':
  26. # run!
  27. app.run(debug=True)
  28. ---------------------------------
  29. ui.html:
  30.  
  31. <script static="static/tabletoggle.js.download"></script>
  32. <div class="limiter">
  33. <div class="container">
  34. <div class="row text-center navpad">
  35. <div class="col">
  36. <button type="button" class="btn btn-outline-primary" id="6hrtog">6 Hour View</button>
  37. </div>
  38. <div class="col">
  39. <button type="button" class="btn btn-outline-primary" id="12hrtog">12 Hour View</button>
  40. </div>
  41. <div class="col">
  42. <button type="button" class="btn btn-outline-primary" id="24hrtog">24 Hour View</button>
  43. </div>
  44. <div class="col">
  45. <button type="button" class="btn btn-outline-danger">Admin Panel</button>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="container-table100" id="6hr" style="display: none;">
  50. <div class="wrap-table100">
  51. <div class="table100 ver1 m-b-110">
  52. <div class="table100-head">
  53. <table>
  54. <thead>
  55. <tr class="row100 head">
  56. <th class="cell100 column1">I'm</th>
  57. <th class="cell100 column2">the</th>
  58. <th class="cell100 column3">6</th>
  59. <th class="cell100 column4">hour</th>
  60. <th class="cell100 column5">table</th>
  61. </tr>
  62. </thead>
  63. </table>
  64. </div>
  65.  
  66. -----------------------
  67. in the tabletoggle.js
  68.  
  69. $(function() {
  70. $('#6hrtog').click(function() {
  71. $('#6hr').show();
  72. $('#12hr').hide();
  73. $('#24hr').hide();
  74. });
  75. $('#12hrtog').click(function() {
  76. $('#6hr').hide();
  77. $('#12hr').show();
  78. $('#24hr').hide();
  79. });
  80. $('#24hrtog').click(function() {
  81. $('#6hr').hide();
  82. $('#12hr').hide();
  83. $('#24hr').show();
  84. });
  85. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement