Pressing enter inside input now posts, further improvements

This commit is contained in:
ElPumpo
2018-06-09 19:00:29 +02:00
parent f4291d1564
commit 4433dbd68d
6 changed files with 38 additions and 6 deletions
+19
View File
@@ -34,10 +34,29 @@ $(window).ready(function () {
$('#deposit_amount').val(0);
})
$('#deposit_amount').on("keyup", function(e) {
if (e.keyCode == 13) {
$.post('http://esx_atm/deposit', JSON.stringify({
amount: $('#deposit_amount').val()
}));
$('#deposit_amount').val(0);
}
});
$('#withdraw_btn').on('click', function () {
$.post('http://esx_atm/withdraw', JSON.stringify({
amount: $('#withdraw_amount').val()
}));
$('#withdraw_amount').val(0);
});
$('#withdraw_amount').on("keyup", function(e) {
if (e.keyCode == 13) {
$.post('http://esx_atm/withdraw', JSON.stringify({
amount: $('#withdraw_amount').val()
}));
$('#withdraw_amount').val(0);
}
});
});