質問編集履歴
5
文法の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|

|
20
20
|
|
21
21
|
### 該当のソースコード
|
22
|
-
```
|
22
|
+
```JavaScript
|
23
23
|
// @param {string} no リンク番号
|
24
24
|
// @param {object} prm {setType: string , cnctType: string, mkr: string, mdl: string, year: string}
|
25
25
|
|
4
文法の修正、情報追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,5 +15,63 @@
|
|
15
15
|
- [ ] デバッグ時のアドレスはポート番号ではなくフォルダ名でもよいのか知りたい。
|
16
16
|
- [ ] ポート番号とフォルダ(vscodeではプロジェクト?)の関係を知りたい。
|
17
17
|
|
18
|
+
### 発生している問題・エラーメッセージ
|
19
|
+

|
20
|
+
|
21
|
+
### 該当のソースコード
|
22
|
+
```java script
|
23
|
+
// @param {string} no リンク番号
|
24
|
+
// @param {object} prm {setType: string , cnctType: string, mkr: string, mdl: string, year: string}
|
25
|
+
|
26
|
+
|
27
|
+
export async function getDataFromPHP(no, prm) {
|
28
|
+
let url;
|
29
|
+
if (prm["cnctType"] === "dev") {
|
30
|
+
url = "../dist/php/getGeo.php";
|
31
|
+
} else {
|
32
|
+
url = "../php/getGeo.php";
|
33
|
+
}
|
34
|
+
|
35
|
+
//URLSearchParamsは連想配列からクエリパラメータを作成してくれるAPI
|
36
|
+
// const qPrm = new URLSearchParams(prm);
|
37
|
+
|
38
|
+
//method:GETはパラメータを送らずにURLからデータを取得するだけ > パラメータがないのでbodyがない
|
39
|
+
//method:POSTはパラメータを送って処理を実施後にURLから処理後のデータを取得する > パラメータがあるのでbodyが必須
|
40
|
+
const params = {### ヘディングのテキスト
|
41
|
+
method: "POST",
|
42
|
+
headers: {
|
43
|
+
"Content-Type": "application/json",
|
44
|
+
},
|
45
|
+
body: JSON.stringify(prm),
|
46
|
+
};
|
47
|
+
|
48
|
+
//awaitでpromiseが返ってくるのを待つ
|
49
|
+
// const res = await fetch(`${url}?${qPrm}`).catch((err) => console.log(err));
|
50
|
+
const res = await fetch(url, params).catch((err) => console.log(err));
|
51
|
+
// console.log(res.text()); //Promisseの結果を表示、詳細なエラーが分かる
|
52
|
+
const values = await res.json().catch((err) => console.log(err)); //今回のエラー発生箇所
|
53
|
+
// console.log(values);
|
54
|
+
setDataToMakerModel(prm["setType"], no, values);
|
55
|
+
if (prm["setType"] === "geometry") {
|
56
|
+
setDataToSize($("#size-table > tr"), no, values);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
```
|
60
|
+
### フォルダ構成
|
61
|
+

|
62
|
+
|
63
|
+
### ページ表示 localhost:5500
|
64
|
+

|
65
|
+
|
66
|
+
|
67
|
+
### ページ表示 localhost/chari
|
68
|
+

|
69
|
+
|
70
|
+
### 試したこと
|
71
|
+
|
72
|
+
ここに問題に対して試したことを記載してください。
|
73
|
+
|
18
74
|
### 補足情報(FW/ツールのバージョンなど)
|
19
75
|
mac, vscode, mamp
|
76
|
+
|
77
|
+
|
3
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
### 前提
|
2
2
|
各種サイトにあるデバッグ方法のポート番号によるアドレスの記述だと、ページの表示とjava scriptの実行はされますがphpだけが実行されません。
|
3
3
|
|
4
|
+
Local host のポート番号の部分のみフォルダ名にするとPHPが動作します。
|
4
|
-
localhost:5500/dist/index.html →PHP動作しない
|
5
|
+
localhost:5500/dist/index.html →PHP動作しない
|
5
|
-
localhost/chari/dist/index.html →PHP動作する
|
6
|
+
localhost/chari/dist/index.html →PHP動作する
|
6
7
|
|
7
8
|
どちらもmampは起動しています。
|
8
9
|
環境はmac, mamp, vscode(live server, php server)です。
|
2
文章の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
### 前提
|
2
2
|
各種サイトにあるデバッグ方法のポート番号によるアドレスの記述だと、ページの表示とjava scriptの実行はされますがphpだけが実行されません。
|
3
3
|
|
4
|
-
localhost:5500/dist/index.html
|
4
|
+
localhost:5500/dist/index.html →PHP動作しない
|
5
|
-
localhost/chari/dist/index.html
|
5
|
+
localhost/chari/dist/index.html →PHP動作する
|
6
6
|
|
7
7
|
どちらもmampは起動しています。
|
8
8
|
環境はmac, mamp, vscode(live server, php server)です。
|
@@ -16,4 +16,3 @@
|
|
16
16
|
|
17
17
|
### 補足情報(FW/ツールのバージョンなど)
|
18
18
|
mac, vscode, mamp
|
19
|
-
|
1
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
### 前提
|
2
|
-
各種サイトにあるデバッグ方法のポート番号によるアドレスの記述だと、
|
2
|
+
各種サイトにあるデバッグ方法のポート番号によるアドレスの記述だと、ページの表示とjava scriptの実行はされますがphpだけが実行されません。
|
3
3
|
|
4
4
|
localhost:5500/dist/index.html
|
5
5
|
localhost/chari/dist/index.html
|