无法通过ajax传递数组[重复]

This question already has an answer here:

Trying to have data passed to a php script so the said data can be added to the session. The debug console log returns are the following: the quant array is correct and typeof is object, the JSON.stringified data's type is string , lastly success from the ajax success.
In the PHP script var_dump return is NULL

    $('#bigsubmit').click(function() {
    var quant = [];
    $('.input-number').each(function() {
        var tmp = {};
        tmp.id = this.id;
        tmp.qu = $(this).val();

        quant.push(tmp);
    });
    console.log(quant);
    var data = JSON.stringify(quant);
    console.log(typeof(data));
    $.ajax({
        type: "POST",
        url: url,           
        data: {
            data: data
        },
        success: function() { 
            console.log("success");     
        }
    }); 

the php script (url var)

<?php
session_start();
$_SESSION['test'] = $_POST['data'];
var_dump($_SESSION['test']);

?>
</div>

Your success callback function isn't taking in a parameter, try changing to this,

success:function(data) {
   console.log(data);
}