bruce (owner)

Revisions

gist: 84389 Download_button fork
public
Public Clone URL: git://gist.github.com/84389.git
Embed All Files: show embed
dash-javascript-test.html #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
  <head>
    <script type="text/javascript" src="/jquery.js"></script>
    <script type="text/javascript" src="/dash-javascript/jquery.dash.js"></script>
    <script type="text/javascript">
    
      /* token taken from Adam's working sample on github */
      var token = 'b1b546e3b454d17cd7a61987e9d8087c2eca0336';
 
      /*
You need to make sure you wrap teh code in $(function(){ ... })
so that it waits to be executed until after the DOM has been loaded.
(this is shorthand for jQuery's ready())
*/
      $(function(){
        $('#demo0').dash(
          {fetch: 'latest', token: token, metric: 'cpu'},
          function(value) { $(this).append(value); }
        );
      });
    </script>
  </head>
  <body>
    <div id="demo0">
      Latest CPU value:
    </div>
  </body>
</html>