回答編集履歴

3

ちょうせい

2019/10/02 02:32

投稿

yambejp
yambejp

スコア116661

test CHANGED
@@ -56,9 +56,29 @@
56
56
 
57
57
  body.append("myfile", blob,"test.png");
58
58
 
59
+ const url="up.php";
60
+
59
61
  const method = "POST";
60
62
 
61
- fetch('up.php', {method, body}).then(data=>data.text()).then(console.log)
63
+ fetch(url, {method, body}).then(data=>data.text()).then(console.log)
64
+
65
+
66
+
67
+ /* 念の為、ajaxなら上記fetchの行をこうしてください
68
+
69
+ const xhr = new XMLHttpRequest();
70
+
71
+ xhr.open(method,url);
72
+
73
+ new Promise(resolve=>{
74
+
75
+ xhr.addEventListener("load" ,e=>resolve(e.target.response));
76
+
77
+ }).then(console.log);
78
+
79
+ xhr.send(body);
80
+
81
+ */
62
82
 
63
83
  });
64
84
 

2

chousei

2019/10/02 02:32

投稿

yambejp
yambejp

スコア116661

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <script>
8
8
 
9
- window.addEventListener('DOMContentLoaded', function(e){
9
+ window.addEventListener('DOMContentLoaded', ()=>{
10
10
 
11
11
  /* canvas作成 */
12
12
 

1

chousei

2019/10/02 01:08

投稿

yambejp
yambejp

スコア116661

test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  [].forEach.call(bin,(x,y)=>buffer[y]=bin.charCodeAt(y));
48
48
 
49
- const blob = new Blob([buffer.buffer], {type: type});
49
+ const blob = new Blob([buffer.buffer], {type});
50
50
 
51
51
 
52
52