|
@@ -42,10 +42,41 @@
|
|
|
</div>
|
|
|
|
|
|
<br>
|
|
|
-<button onclick="move()">Click Me</button>
|
|
|
+<button onclick="move2()">Click Me</button>
|
|
|
|
|
|
<script>
|
|
|
+
|
|
|
+var ws = new WebSocket('ws://www.choozmo.com:8888/progress');
|
|
|
+ ws.onmessage = function(event) {
|
|
|
+ console.log(event.data);
|
|
|
+ var elem = document.getElementById("myBar");
|
|
|
+ elem.style.width = event.data + "%";
|
|
|
+ elem.innerHTML = event.data + "%";
|
|
|
+ };
|
|
|
+ function sendMessage(event) {
|
|
|
+ var input = document.getElementById("messageText")
|
|
|
+ ws.send(input.value)
|
|
|
+ input.value = ''
|
|
|
+ event.preventDefault()
|
|
|
+ }
|
|
|
var i = 0;
|
|
|
+function move2(){
|
|
|
+ $.ajax({
|
|
|
+ url: 'http://www.choozmo.com:8888/autoprogress',
|
|
|
+ //url: 'http://www.choozmo.com:8888/qqreq',
|
|
|
+ dataType : 'json', // 預期從server接收的資料型態
|
|
|
+ contentType : 'application/json; charset=utf-8', // 要送到server的資料型態
|
|
|
+ type: 'post',
|
|
|
+ data: JSON.stringify({'imgurl':'non'}),
|
|
|
+ success: function(suc_data) {
|
|
|
+ alert(suc_data.msg)
|
|
|
+ },
|
|
|
+ //data:JSON.stringify({n1:"12",n2:"22"}),
|
|
|
+ error: function (error) {
|
|
|
+ alert(error)
|
|
|
+ }
|
|
|
+});
|
|
|
+}
|
|
|
function move() {
|
|
|
if (i == 0) {
|
|
|
i = 1;
|