回答編集履歴
1
test
test
CHANGED
@@ -1 +1,47 @@
|
|
1
1
|
たとえばformタグにmethod="post"が抜けているとかそのレベルの話?
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```javascript
|
6
|
+
|
7
|
+
<?PHP
|
8
|
+
|
9
|
+
print_r($_POST);
|
10
|
+
|
11
|
+
?>
|
12
|
+
|
13
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
|
17
|
+
$(function(){
|
18
|
+
|
19
|
+
var carts = [
|
20
|
+
|
21
|
+
{name:'商品A'},
|
22
|
+
|
23
|
+
{name:'商品B'},
|
24
|
+
|
25
|
+
{name:'商品C'}
|
26
|
+
|
27
|
+
];
|
28
|
+
|
29
|
+
var carts_json = JSON.stringify(carts);
|
30
|
+
|
31
|
+
$('#carts_hidden').val(carts_json);
|
32
|
+
|
33
|
+
});
|
34
|
+
|
35
|
+
</script>
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
<form method="post">
|
40
|
+
|
41
|
+
<input id="carts_hidden" type="hidden" name="carts" value="">
|
42
|
+
|
43
|
+
<input type="submit" value="send">
|
44
|
+
|
45
|
+
</form>
|
46
|
+
|
47
|
+
```
|