質問編集履歴
8
イメージ図追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,17 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
(
|
15
|
+
![イメージ説明](01a12b377f7093895967ff0b434b709f.png)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
16
|
|
27
17
|
|
28
18
|
|
7
イメージ図追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,6 +9,20 @@
|
|
9
9
|
###発生している問題・エラーメッセージ
|
10
10
|
|
11
11
|
クリックイベントで通信確認用のアラートは機能したのですが、cakephpのコントローラー内の書き方がわからず、index.ctpに変数が反映されなくて困っています。
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
(cb2cc46ed4c6a448320137fa5f9d6c76.png)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
12
26
|
|
13
27
|
|
14
28
|
|
6
表題の修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
jsファイル内
|
1
|
+
jsファイル内で生成した変数をcakephpの変数に渡したい
|
test
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
###前提・実現したいこと
|
2
2
|
|
3
|
-
外出ししたjsファイルでクリックイベント毎に変数を生成し、
|
3
|
+
外出ししたjsファイルでクリックイベント毎に変数を生成し、cake2(var.2.7)に渡してPHPの変数としても使用したい。
|
4
|
+
|
5
|
+
ネットで調べながらコーディングしています。ajaxを使っていますが方法は問いません。
|
4
6
|
|
5
7
|
|
6
8
|
|
5
UserController\.php data\("name"\)をdata\["name"\]に修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,13 +88,15 @@
|
|
88
88
|
|
89
89
|
if($this->request->is('ajax')) {
|
90
90
|
|
91
|
-
$this->autoRender = true;
|
91
|
+
$this->autoRender = true;
|
92
92
|
|
93
|
-
echo $this->request->data
|
93
|
+
//echo $this->request->data["name"]." :controller内のリクエスト確認用";
|
94
94
|
|
95
|
-
$data =$this->request->data("name");
|
95
|
+
//$data = $this->request->data("name");
|
96
96
|
|
97
|
+
$data = $this->request->data["name"];
|
98
|
+
|
97
|
-
$this->set('index', $data);
|
99
|
+
$this->set('index', $data);
|
98
100
|
|
99
101
|
}else{
|
100
102
|
|
4
UserController\.phpの編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,15 +80,21 @@
|
|
80
80
|
|
81
81
|
class UsersController extends AppController {
|
82
82
|
|
83
|
+
|
84
|
+
|
83
85
|
public function index() {
|
86
|
+
|
87
|
+
|
84
88
|
|
85
89
|
if($this->request->is('ajax')) {
|
86
90
|
|
87
|
-
$this->autoRender =
|
91
|
+
$this->autoRender = true;
|
88
92
|
|
89
|
-
echo $this->request->data
|
93
|
+
echo $this->request->data("name")." :controller内のリクエスト確認用";
|
90
94
|
|
91
|
-
$
|
95
|
+
$data =$this->request->data("name");
|
96
|
+
|
97
|
+
$this->set('index', $data);
|
92
98
|
|
93
99
|
}else{
|
94
100
|
|
3
\("name"\) を\["name"\]に
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,7 +88,7 @@
|
|
88
88
|
|
89
89
|
echo $this->request->data["name"];//アラート用
|
90
90
|
|
91
|
-
$index=$this->request->data
|
91
|
+
$index=$this->request->data["name"];//index.ctp用
|
92
92
|
|
93
93
|
}else{
|
94
94
|
|
2
追加項目のインデント位置を整頓
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,7 +84,7 @@
|
|
84
84
|
|
85
85
|
if($this->request->is('ajax')) {
|
86
86
|
|
87
|
-
$this->autoRender = FALSE;
|
87
|
+
$this->autoRender = FALSE;
|
88
88
|
|
89
89
|
echo $this->request->data["name"];//アラート用
|
90
90
|
|
1
\$this->autoRender = FALSE;を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -84,9 +84,11 @@
|
|
84
84
|
|
85
85
|
if($this->request->is('ajax')) {
|
86
86
|
|
87
|
+
$this->autoRender = FALSE;
|
88
|
+
|
87
89
|
echo $this->request->data["name"];//アラート用
|
88
90
|
|
89
|
-
$
|
91
|
+
$index=$this->request->data("name");//index.ctp用
|
90
92
|
|
91
93
|
}else{
|
92
94
|
|