質問編集履歴

3

コードの表示崩れを調整

2018/08/05 11:23

投稿

uramachine
uramachine

スコア7

test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,9 @@
8
8
 
9
9
  ```ここに言語を入力
10
10
 
11
+ let xhr = new XMLHttpRequest;
12
+
11
- r.addEventListener('progress', function(event){
13
+ xhr.addEventListener('progress', function(event){
12
14
 
13
15
  console.log(event.loaded, event.total);
14
16
 

2

コードの表示崩れを調整

2018/08/05 11:23

投稿

uramachine
uramachine

スコア7

test CHANGED
File without changes
test CHANGED
@@ -4,9 +4,11 @@
4
4
 
5
5
  ソースコード例
6
6
 
7
- ``let xhr = new XMLHttpRequest;
8
7
 
8
+
9
+ ```ここに言語を入力
10
+
9
- xhr.addEventListener('progress', function(event){
11
+ r.addEventListener('progress', function(event){
10
12
 
11
13
  console.log(event.loaded, event.total);
12
14
 
@@ -14,7 +16,9 @@
14
16
 
15
17
  xhr.open('GET', fileName, true);
16
18
 
17
- xhr.send(null);```
19
+ xhr.send(null);
20
+
21
+ ```
18
22
 
19
23
 
20
24
 

1

コード追加、サーバ情報を追加

2018/08/05 11:23

投稿

uramachine
uramachine

スコア7

test CHANGED
File without changes
test CHANGED
@@ -1 +1,21 @@
1
1
  Progressイベントを利用してプログレスバーを作る際に、特定のサーバー上だとevent.totalが取得できず、0の値が返ってきてしまいます。これはサーバー側に何かしらの設定をしないといけないのでしょうか?
2
+
3
+
4
+
5
+ ソースコード例
6
+
7
+ ``let xhr = new XMLHttpRequest;
8
+
9
+ xhr.addEventListener('progress', function(event){
10
+
11
+ console.log(event.loaded, event.total);
12
+
13
+ }, false);
14
+
15
+ xhr.open('GET', fileName, true);
16
+
17
+ xhr.send(null);```
18
+
19
+
20
+
21
+ サーバはApacheです。