teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

chousei

2021/07/27 01:37

投稿

yambejp
yambejp

スコア117906

answer CHANGED
@@ -2,11 +2,19 @@
2
2
 
3
3
  //sample.html
4
4
  ```javascript
5
+ const calcFileUpdate = async (a,b,c)=>{
5
- const body=new FormData();
6
+ const body=new FormData();
6
- body.append("a"," 123");
7
+ body.append("aaa",a);
7
- body.append("b","456 ");
8
+ body.append("bbb",b);
9
+ body.append("ccc",c);
8
- fetch("sample.php",{method:"post",body}).then(res=>res.text()).then(console.log);
10
+ return await fetch("sample.php",{method:"post",body}).then(res=>res.text());
11
+ };
12
+ (async()=>{
13
+ const res=await calcFileUpdate(1,2,3);
14
+ console.log(res);
15
+ })();
9
16
  ```
17
+ ※調整版
10
18
  //sample.php
11
19
  ```PHP
12
20
  <?PHP