From 6b39b86447d634be91c4b5e215ea516add999380 Mon Sep 17 00:00:00 2001 From: OutCast3k Date: Wed, 16 Sep 2015 11:41:18 +0000 Subject: [PATCH] updated the #broadcast page to use jquerys POST request over the GET request that was being used to handle larger transactions --- js/coinbin.js | 34 ++++++++++++++++++++++------------ sha1sum | 2 +- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/js/coinbin.js b/js/coinbin.js index aa3618a..376c043 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -830,20 +830,30 @@ $(document).ready(function() { // broadcast transaction vai coinbin (default) function rawSubmitDefault(btn){ - var thisbtn = btn; - var tx = coinjs.transaction(); + var thisbtn = btn; $(thisbtn).val('Please wait, loading...').attr('disabled',true); - tx.broadcast(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(' '); + $.ajax ({ + type: "POST", + url: coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=bitcoin&request=sendrawtransaction', + data: {'rawtx':$("#rawTransaction").val()}, + dataType: "xml", + error: function(data) { + $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(" There was an error submitting your request, please try again").prepend(''); + }, + 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(' '); + } + }, + 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) diff --git a/sha1sum b/sha1sum index bb009a3..d13781d 100644 --- a/sha1sum +++ b/sha1sum @@ -11,7 +11,7 @@ ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js 64eb4ea5c882f8bce3e1885bf00728455f1c2f4c ./js/ripemd160.js 114089ef2a3feb6d4db4f9cabcb186d7750d5884 ./js/sha512.js 8c2654113866b4a57fec302665ca2187a3eb7614 ./js/coin.js -ea12ffead9a3ece7937d9c8391cb9867369ed2e7 ./js/coinbin.js +c92e6c2fb836c2e262b4e0cec703fca0a4b435eb ./js/coinbin.js ae49e56999d82802727455f0ba83b63acd90a22b ./js/jquery-1.9.1.min.js 5f570018ed044eafd464f7e0ab1783b966224055 ./LICENCE ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css