Skip to content

Commit

Permalink
updated the #broadcast page to use jquerys POST request over the GET …
Browse files Browse the repository at this point in the history
…request that was being used to handle larger transactions
  • Loading branch information
OutCast3k committed Sep 16, 2015
1 parent 9023706 commit 6b39b86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
34 changes: 22 additions & 12 deletions js/coinbin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<span class="glyphicon glyphicon-exclamation-sign"></span> ');
$.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('<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)
Expand Down
2 changes: 1 addition & 1 deletion sha1sum
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b39b86

Please sign in to comment.