回答編集履歴
2
this統一
answer
CHANGED
@@ -58,17 +58,17 @@
|
|
58
58
|
var xhr = new XMLHttpRequest;
|
59
59
|
xhr.open('get', '/api/execute_shellcommand.php', true);
|
60
60
|
xhr.onreadystatechange = function () {
|
61
|
-
if (
|
61
|
+
if (this.status === 200 && this.readyState === 3) {
|
62
62
|
// chunkの一部分が返ってきたときテキストエリアを更新
|
63
63
|
area.textContent = this.responseText;
|
64
64
|
return;
|
65
65
|
}
|
66
|
-
if (
|
66
|
+
if (this.status === 200 && this.readyState === 4) {
|
67
67
|
// 終了時
|
68
68
|
start.disabled = false;
|
69
69
|
return;
|
70
70
|
}
|
71
|
-
if (
|
71
|
+
if (this.status !== 200 && this.readyState === 4) {
|
72
72
|
// エラー時
|
73
73
|
alert('エラー!');
|
74
74
|
start.disabled = false;
|
1
補足
answer
CHANGED
@@ -85,5 +85,6 @@
|
|
85
85
|
|
86
86
|
```
|
87
87
|
|
88
|
-
|
88
|
+
**Apacheとか`php -S`に頼らず全てWebサーバまでPHPで実装した**例があるのでこちらに貼っておきますw
|
89
|
+
(あんまり参考にならないかも)
|
89
90
|
[https://github.com/mpyw/http-tutorial-with-php](https://github.com/mpyw/http-tutorial-with-php)
|