disable/enable fee Transaction input field

This commit is contained in:
Cofresi 2016-11-10 00:05:27 -04:00
parent 6a24251860
commit 57c9415e12

View file

@ -150,11 +150,11 @@
if (isAlphaNumeric(txidfield.val())) { if (isAlphaNumeric(txidfield.val())) {
txidfield.unbind( "change" ); txidfield.unbind( "change" );
console.log('feeTxid seems good: ' + txidfield.val()); console.log('feeTxid seems good: ' + txidfield.val());
//$("#feeTxid").attr("disabled", true);
console.log("wait while we check the api!"); console.log("wait while we check the api!");
// first check if transactionid is already in api // first check if transactionid is already in api
$.getJSON(apiserversocket + 'insight-api-dash/tx/' + txidfield.val(), function(data) { $.getJSON(apiserversocket + 'insight-api-dash/tx/' + txidfield.val(), function(data) {
txidfield.attr("disabled", true);
var confirmations = data.confirmations; var confirmations = data.confirmations;
console.log('Transaction has ' + confirmations + ' confirmation(s)'); console.log('Transaction has ' + confirmations + ' confirmation(s)');
if (confirmations != 'undefined' && $.isNumeric(confirmations)) { if (confirmations != 'undefined' && $.isNumeric(confirmations)) {
@ -205,14 +205,16 @@
} }
else { else {
console.log('Something went terribly wrong. Faulty api data?'); console.log('Something went terribly wrong. Faulty api data?');
txidfield.attr("disabled", false);
} }
}).fail(function(jqXHR) { }).fail(function(jqXHR) {
if (jqXHR.status == 400) { if (jqXHR.status == 400) {
// there seems to be a problem with your feeTxid because txid is not found in api // there seems to be a problem with your feeTxid because txid is not found in api
console.log('problem with feeTxid! Ask for new input!'); console.log('problem with feeTxid! Ask for new input!');
alert("Check again and please enter your correct TxID!"); alert("Check again and please enter your correct TxID!");
$("#feeTxid").attr("disabled", false); txidfield.attr("disabled", false);
} else { } else {
txidfield.attr("disabled", false);
console.log('There seems to be a problem with the api connection'); console.log('There seems to be a problem with the api connection');
} }
}); });