summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2013-03-10 13:48:35 +0200
committerYuval Adam <yuv.adm@gmail.com>2013-03-10 13:48:35 +0200
commit27a1f8b8755aadcf63906005f297ff8b9b0678f9 (patch)
treefae18f5ed4961b2182c1c36cdc17882db3105d40 /index.html
parent6b2e0794d3e1786370368ade88b042f96bb0607a (diff)
Send entire order messages
Diffstat (limited to 'index.html')
-rw-r--r--index.html20
1 files changed, 16 insertions, 4 deletions
diff --git a/index.html b/index.html
index bbc2d6a..ba53bb6 100644
--- a/index.html
+++ b/index.html
@@ -6,6 +6,8 @@
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(document).ready(function() {
+ var client_id = Math.random().toString(36).substring(7);
+
function show_message(msg){
$('#messages').prepend('<p>' + msg + '<p>');
}
@@ -21,9 +23,15 @@
show_message('B⃦ Closed.');
}
- $('#order').click(function() {
- var order = $('#order-msg').val();
+ $('#order-submit').click(function() {
+ console.log('presub');
+ var type = $('input:radio[name=type]:checked').val();
+ var price = $('#order-price').val();
+ var amount = $('#order-amount').val();
+ var order = client_id + '|' + type + '|' + price + '|' + amount
ws.send(order);
+ console.log('postsub');
+ return false;
});
});
</script>
@@ -34,8 +42,12 @@
<h1>{{ title }}</h1>
<h2>Order</h2>
<p>
- <input id="order-msg" value=""/>
- <input id="order" type="submit" value="Send Order"/>
+ <form id="order-form">
+ <input id="order-bid" type="radio" name="type" value="bid">Buy (bid)</input>
+ <input id="order-ask" type="radio" name="type" value="ask">Sell (ask)</input>
+ <input id="order-price" name="price" placeholder="Price" value=""/>
+ <input id="order-amount" name="amount" placeholder="Amount" value=""/>
+ <input id="order-submit" type="submit" value="Send Order"/>
</p>
<h2>Messages</h2>