如何将JSON obj从jquery传递给PHP

时间:2014-10-23 08:20:02

标签: json

我创建了一个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>

0 个答案:

没有答案