将值从javascript发布到php并在php中添加这些值

arraytest.html

<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>

<input type="button" id="btn" value="go to php" onclick="show()">
<br><br>
<script type="text/javascript">
var a = new Array(6,5);
function show(){
   $.ajax({        
    type: "POST",
    url: "arra.php",
    data: {test : JSON.stringify(a)},
    success: function(data) {
        alert("success" +data);
        }
    }); 
}
</script>

arra.php

<?php 
$arr = json_decode($_POST['test'], true);
$v = $arr[0] + arr[1] ;
echo $v ; 
?>

i couldn't add the array values in php file. anybody could help me with this ? am getting the error as: Parse error: syntax error,unexpected '[' in c:\wamp\www\arra.php on line 3

Your success function isn't showing the response. The callback function should take an argument, and then do something with it.

function show(){
    $.ajax({        
        type: "POST",
        url: "arra.php",
        data: {test : a},
        success: function(response) {
            alert("success, the answer is: " + response);        
        }
    });
}

try changing it to $_POST. notice you are sending POST.

<?php 
    $arr = $_POST['test'];
    $v = $arr[0] + $arr[1];
    echo $v; 
?>