Post
Topic
Board Service Discussion
Re: How to correctly push transaction?
by
DrSeuss
on 23/01/2017, 16:14:57 UTC
I'm using Javascript. Smiley

Code:
$.ajax({
                                    url: "http://btc.blockr.io/api/v1/tx/push",
                                    type: "post",
                                    contentType: "application/json; charset=utf-8",
                                    dataType: "json",
                                    data2: {
                                    hex: transactionHex
                                    },
                                    success: function(response) {
                                        console.log("Transaction pushed. " + response);
                                    },
                                    error: function(xhr) {
                                        console.log("Failed to Push: " + xhr.responseText);
                                        console.log("Transaction Hash: " + transactionHex);
                                        console.log("This is pushed: " + JSON.stringify(this.data2));
                                    }
                                });

I now declared that I will send a json but..

Code:
This is pushed: "{\"hex\":\"010000000194bacfdc39a29fb55269ff2e1bf91140bf3d08efa943b6c8c131a059c15ec23f01000000694630430220691210387a5a5897afedf546e42a482265b2be96ba36f5e2624168f4d94df8d7021f587c9b670089d81f0aee897364aa6e3320f0a9235e5f70924bbaee287f0f6d01210250a251bd8365ee73a91fe09cb3477b400841c158a59874a8b041e7dff48412e5ffffffff0280969800000000001976a9142ca0f264fcffd0ceb34b109e1403a11ecacd73b288ac00b7ef08000000001976a914251fafe412cdd9d4f32aabb8ea8858a97203016588ac00000000\"}"

it fails Cry