我创建了一个JSON对象并将其存储在一个javascript变量中,现在我正在尝试将javascript变量值提取到一个php变量中,但它显示错误。以下是我的代码
<html>
<head>
<script type="text/javascript">
var tp = [
{"Name" : "Abhimanyu", "Designation" : "Trainee Engineer"},
{"Name" : "Parag", "Designation" : "Trainee Engineer"}
];
var p = (tp[0]["Name"]);
console.log(p);
// alert(tp.names.Designation);
</script>
</head>
<body>
<?php
$c = $_GET['p'];
echo "Value is " .$c;
?>
</body>
</html>