Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
  8. <meta name="description" content="">
  9. <meta name="author" content="xxx">
  10.  
  11.  
  12. <title>Temperature Limit</title>
  13.  
  14. <!-- Bootstrap core CSS -->
  15. <link href="dist/css/bootstrap.min.css" rel="stylesheet">
  16.  
  17. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  18. <link href="assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
  19.  
  20. <!-- Custom styles for this template -->
  21. <link href="jumbotron-narrow.css" rel="stylesheet">
  22.  
  23.  
  24. <script src="assets/js/ie-emulation-modes-warning.js"></script>
  25.  
  26. </head>
  27.  
  28. <body>
  29. <div class="container">
  30. <div class="jumbotron">
  31. <h4><b>Type temperature limit</b></h4>
  32. <form class="form-horizontal">
  33. <div class="form-group" >
  34. <label class="control-label col-sm-4" for="minTemp">Minimal: </label>
  35. <div class="col-sm-6">
  36. <input type="number" class="form-control" id="minTemp" min="10" max="25" >
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="control-label col-sm-4" for="maxTemp">Maximal:</label>
  41. <div class="col-sm-6">
  42. <input type="number" class="form-control" id="maxTemp" min="25" max="40">
  43. </div>
  44. </div>
  45.  
  46.  
  47. <div class="form-group">
  48. <div class="col-sm-offset-4 col-sm-5">
  49. <button id="saveTermBut" type="submit" class="btn btn-sm btn-default">Save</button>
  50. </div>
  51. </div>
  52. </form>
  53. </div>
  54. </div>
  55.  
  56.  
  57. <div class="container">
  58. <h2>Current Conditions </h2>
  59. <div class="jumbotron">
  60. <div class="container col-lg-6">
  61. <div class="form-group">
  62. <label class="control-label " for="currTemp">Minimal Temp:</label>
  63. <output id="currTemp">
  64. </div>
  65. </div>
  66. <div class="container">
  67. <div class="form-group">
  68. <label class="control-label " for="currTemp1">Maximal Temp:</label>
  69. <output id="currTemp1">
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <footer class="footer">
  75. <p>&copy; 2016 Company, Inc.</p>
  76. </footer>
  77.  
  78.  
  79. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  80. <script src="assets/js/ie10-viewport-bug-workaround.js"></script>
  81. <script src="jquery.js">
  82.  
  83. <script src="SaveTempLimit.js"></script>
  84. </body>
  85. </html>
  86.  
  87. $(document).ready(function () {
  88.  
  89.  
  90. $.ajax({
  91. type: 'GET',
  92. url: 'tempLimit.json',
  93. dataType: 'json',
  94. success: function (tempLimit) {
  95.  
  96. $('#currTemp.form-group').append(tempLimit.minTemp);
  97. $('#currTemp1.form-group').append(tempLimit.maxTemp);
  98.  
  99. }
  100.  
  101. });
  102.  
  103. $('#saveTermBut').on('click', function () {
  104.  
  105. var limitTemps = {};
  106. limitTemps.minTemp = $('#minTemp.form-control').val();
  107. limitTemps.maxTemp = $('#maxTemp.form-control').val();
  108.  
  109.  
  110. $.ajax({
  111. type: 'POST',
  112. url: 'tempLimit.json',
  113. dataType: 'json',
  114. data: limitTemps,
  115. success: function () {
  116. console.log(limitTemps);
  117. },
  118. error: function (err) {
  119. alert(err);
  120. }
  121. });
  122.  
  123.  
  124.  
  125.  
  126. });
  127. });
  128.  
  129. {
  130. "minTemp": "20", "maxTemp":"22"
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement