質問編集履歴

3

余計な箇所を削除しました

2016/04/05 11:37

投稿

chiro.0519
chiro.0519

スコア118

test CHANGED
File without changes
test CHANGED
@@ -88,8 +88,6 @@
88
88
 
89
89
  <section>
90
90
 
91
- <?php require_once("load/load1.inc"); ?>
92
-
93
91
  <div id="sample-text"></div>
94
92
 
95
93
  <div id="sample-result"><p style="text-align: center; width:100%;"><img src="loadinfo.net.gif" width="100%" alt=""></p></div>

2

htmlも追加しました。 

2016/04/05 11:37

投稿

chiro.0519
chiro.0519

スコア118

test CHANGED
File without changes
test CHANGED
@@ -28,6 +28,92 @@
28
28
 
29
29
  ```
30
30
 
31
+ ```html
32
+
33
+ <?php require_once('loadData2.php'); ?>
34
+
35
+ <script type="text/javascript">
36
+
37
+ $(function(){
38
+
39
+ var maxLoad = 5;
40
+
41
+ var s = 1;
42
+
43
+ var $test = 0;
44
+
45
+ <?php $s = 1; ?>
46
+
47
+
48
+
49
+ $(window).on("load scroll",function() {
50
+
51
+ var sampleH = $('#sample-text').height();
52
+
53
+ var position = $(window).scrollTop() + $(window).height();
54
+
55
+
56
+
57
+ if(document.getElementById("sample-result") != null){var flag = $('#sample-result').offset().top;}
58
+
59
+
60
+
61
+ /*** マックスまで読み込んだら、ロード画像を消す****/
62
+
63
+ if(s == maxLoad){$('#sample-result').css({'display':'none'})}
64
+
65
+ <?php $s++; ?>
66
+
67
+
68
+
69
+ if((<?php echo $s; ?> < maxLoad)&&(flag <= position-100)){
70
+
71
+ $('#sample-result').remove();
72
+
73
+ <!--ここで実行してloadData2.phpの配列を出力したいです-->
74
+
75
+ $('section').append('<div id="sample-result"><p style="text-align: center; width: 100%"><img src="loadinfo.net.gif" alt="" width="100%"></p></div>');
76
+
77
+
78
+
79
+ }
80
+
81
+
82
+
83
+ });
84
+
85
+
86
+
87
+ <body>
88
+
89
+ <section>
90
+
91
+ <?php require_once("load/load1.inc"); ?>
92
+
93
+ <div id="sample-text"></div>
94
+
95
+ <div id="sample-result"><p style="text-align: center; width:100%;"><img src="loadinfo.net.gif" width="100%" alt=""></p></div>
96
+
97
+ </section>
98
+
99
+ </body>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ });
108
+
109
+ </script>
110
+
111
+
112
+
113
+
114
+
115
+ ```
116
+
31
117
  上記を別ファイルで読み込みphp内でechoする事はできたのですが
32
118
 
33
119
  scriptの中で変数に入れてalertすると、script自体が止まってしまいます。

1

ソースをマークダウンしました

2016/04/05 11:36

投稿

chiro.0519
chiro.0519

スコア118

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,8 @@
1
1
  phpで処理した配列を、htmlファイルのjQueryの中で出力したいです。
2
2
 
3
3
 
4
+
5
+ ```php
4
6
 
5
7
  for($i=1; $i<=5; $i++){
6
8
 
@@ -24,6 +26,8 @@
24
26
 
25
27
  }
26
28
 
29
+ ```
30
+
27
31
  上記を別ファイルで読み込みphp内でechoする事はできたのですが
28
32
 
29
33
  scriptの中で変数に入れてalertすると、script自体が止まってしまいます。