updated the #broadcast page to use jquerys POST request over the GET request that was being used to handle larger transactions

This commit is contained in:
OutCast3k 2015-09-16 11:41:18 +00:00
parent 902370679f
commit 6b39b86447
2 changed files with 23 additions and 13 deletions

View file

@ -831,19 +831,29 @@ $(document).ready(function() {
// broadcast transaction vai coinbin (default) // broadcast transaction vai coinbin (default)
function rawSubmitDefault(btn){ function rawSubmitDefault(btn){
var thisbtn = btn; var thisbtn = btn;
var tx = coinjs.transaction();
$(thisbtn).val('Please wait, loading...').attr('disabled',true); $(thisbtn).val('Please wait, loading...').attr('disabled',true);
tx.broadcast(function(data){ $.ajax ({
$("#rawTransactionStatus").html(unescape($(data).find("response").text()).replace(/\+/g,' ')).removeClass('hidden'); type: "POST",
if($(data).find("result").text()==1){ url: coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=bitcoin&request=sendrawtransaction',
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger'); data: {'rawtx':$("#rawTransaction").val()},
$("#rawTransactionStatus").html('txid: '+$(data).find("txid").text()); dataType: "xml",
} else { error: function(data) {
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span> '); $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(" There was an error submitting your request, please try again").prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
},
success: function(data) {
$("#rawTransactionStatus").html(unescape($(data).find("response").text()).replace(/\+/g,' ')).removeClass('hidden');
if($(data).find("result").text()==1){
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger');
$("#rawTransactionStatus").html('txid: '+$(data).find("txid").text());
} else {
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span> ');
}
},
complete: function(data, status) {
$("#rawTransactionStatus").fadeOut().fadeIn();
$(thisbtn).val('Submit').attr('disabled',false);
} }
$("#rawTransactionStatus").fadeOut().fadeIn(); });
$(thisbtn).val('Submit').attr('disabled',false);
}, $("#rawTransaction").val());
} }
// broadcast transaction via blockr.io (mainnet) // broadcast transaction via blockr.io (mainnet)

View file

@ -11,7 +11,7 @@ ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js
64eb4ea5c882f8bce3e1885bf00728455f1c2f4c ./js/ripemd160.js 64eb4ea5c882f8bce3e1885bf00728455f1c2f4c ./js/ripemd160.js
114089ef2a3feb6d4db4f9cabcb186d7750d5884 ./js/sha512.js 114089ef2a3feb6d4db4f9cabcb186d7750d5884 ./js/sha512.js
8c2654113866b4a57fec302665ca2187a3eb7614 ./js/coin.js 8c2654113866b4a57fec302665ca2187a3eb7614 ./js/coin.js
ea12ffead9a3ece7937d9c8391cb9867369ed2e7 ./js/coinbin.js c92e6c2fb836c2e262b4e0cec703fca0a4b435eb ./js/coinbin.js
ae49e56999d82802727455f0ba83b63acd90a22b ./js/jquery-1.9.1.min.js ae49e56999d82802727455f0ba83b63acd90a22b ./js/jquery-1.9.1.min.js
5f570018ed044eafd464f7e0ab1783b966224055 ./LICENCE 5f570018ed044eafd464f7e0ab1783b966224055 ./LICENCE
ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css