|
@@ -246,34 +246,56 @@ $.fn.serializeObject = function () {
|
|
|
$(".collect-send").submit(function (e) {
|
|
|
/* var formRef = $('#form1').serializeArray();
|
|
|
var jsonString = JSON.stringify(formRef);*/
|
|
|
- var jsonInfo = $('.collect-send').serializeObject();
|
|
|
- var jsonString = JSON.stringify(jsonInfo);
|
|
|
- console.log(jsonString);
|
|
|
+
|
|
|
+ var url = "https://api.ptt.cx:8750/api/v1/line/send";
|
|
|
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: 'https://api.ptt.cx:8750/api/v1/line/send',
|
|
|
- data: jsonString,
|
|
|
- dataType: 'json',
|
|
|
- async: false,
|
|
|
- success: function (data) {
|
|
|
- console.log('發送成功: ' + JSON.stringify(data));
|
|
|
- alert("發送成功");
|
|
|
- location.reload();
|
|
|
- },
|
|
|
- beforeSend: function () {
|
|
|
- console.log('beforeSend');
|
|
|
- },
|
|
|
- complete: function () {
|
|
|
- console.log('complete');
|
|
|
- },
|
|
|
- error: function (jqXHR, textStatus, errorThrown) {
|
|
|
- console.log(JSON.stringify(jqXHR));
|
|
|
- console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
|
|
|
- console.log('送出失敗: ' + jqXHR.responseText);
|
|
|
- }
|
|
|
- });
|
|
|
- return false;
|
|
|
+ var xhr = new XMLHttpRequest();
|
|
|
+ xhr.open("POST", url);
|
|
|
+
|
|
|
+ xhr.setRequestHeader("accept", "application/json");
|
|
|
+ xhr.setRequestHeader("Content-Type", "application/json");
|
|
|
+
|
|
|
+ xhr.onreadystatechange = function () {
|
|
|
+ if (xhr.readyState === 4) {
|
|
|
+ console.log(xhr.status);
|
|
|
+ console.log(xhr.responseText);
|
|
|
+ }};
|
|
|
+
|
|
|
+ var data = `{
|
|
|
+ "nftid": "1000",
|
|
|
+ "address": "0xf05cc78a5eba78775847beea5b3ab88d4694d1b6"
|
|
|
+ }`;
|
|
|
+
|
|
|
+ xhr.send(data);
|
|
|
+
|
|
|
+ // var jsonInfo = $('.collect-send').serializeObject();
|
|
|
+ // var jsonString = JSON.stringify(jsonInfo);
|
|
|
+ // console.log(jsonString);
|
|
|
+
|
|
|
+ // $.ajax({
|
|
|
+ // type: 'POST',
|
|
|
+ // url: 'https://api.ptt.cx:8750/api/v1/line/send',
|
|
|
+ // data: jsonString,
|
|
|
+ // dataType: 'json',
|
|
|
+ // async: false,
|
|
|
+ // success: function (data) {
|
|
|
+ // console.log('發送成功: ' + JSON.stringify(data));
|
|
|
+ // alert("發送成功");
|
|
|
+ // location.reload();
|
|
|
+ // },
|
|
|
+ // beforeSend: function () {
|
|
|
+ // console.log('beforeSend');
|
|
|
+ // },
|
|
|
+ // complete: function () {
|
|
|
+ // console.log('complete');
|
|
|
+ // },
|
|
|
+ // error: function (jqXHR, textStatus, errorThrown) {
|
|
|
+ // console.log(JSON.stringify(jqXHR));
|
|
|
+ // console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
|
|
|
+ // console.log('送出失敗: ' + jqXHR.responseText);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // return false;
|
|
|
});
|
|
|
|
|
|
$(".nft-buy").submit(function (e) {
|
|
@@ -281,7 +303,7 @@ $(".nft-buy").submit(function (e) {
|
|
|
var jsonString = JSON.stringify(formRef);*/
|
|
|
var jsonInfo = $('.nft-buy').serializeObject();
|
|
|
var jsonString = JSON.stringify(jsonInfo);
|
|
|
- console.log(jsonString),
|
|
|
+ console.log(jsonString);
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|