I have a Websocket server that sends datas from 1 to 1024.
Using JQuery, I am trying to set a progress bar that shows the actual value received. It does not work...
Here is my code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script>
    "use strict";
    // Initialize everything when the window finishes loading
    window.addEventListener("load", function(event) {
      var message = document.getElementById("message");
      var socket;
        // Create a new connection to websocket server
        socket = new WebSocket("ws://xx.xx.xx.xx:8080", "echo-protocol");
        // Display messages received from the server
        socket.addEventListener("message", function(event) {
          $("#progressbar").progressbar("option", "value", event.data);
          message.textContent = event.data;
        });
    });
  </script>
  <script>
$(document).ready(function() {
  $( "#progressbar" ).progressbar({
      min: 1,
      max: 1024
    });
    $("#progressbar").progressbar("option", "value", event.data);
});
</script>
</head>
<body>
<div id="data">
<div id="progressbar"></div>
<div id="message"></div>
</div>
</div>
The fact is that #message div displays values with no problems, but i am not able to update the JQuery progressbar...
Any idea would be welcome...
 
     
    