如何使用AJAX将多个值发布到PHP函数?

I have this code:

    var name= "theName";
    var surname= $('#surname').val();
    $.ajax({
        url: 'SaveEdit.php',
        type: 'post',
        data: { "callFunc1": whichOne},
        success: function(response) { 
        alert(response);
        }
    });

It's working, but i need to do something like this:

    var name= "theName";
    var surname= $('#surname').val();
    $.ajax({
        url: 'SaveEdit.php',
        type: 'post',
        data: { "callFunc1": whichOne, name},
        success: function(response) { 
        alert(response);
        }
    });

It gives me errors like:
Warning: missing argument 2 for func1()

I am using this code too:

function func1($data, $name){
    //some code here
}    

if (isset($_POST['callFunc1'])) {
    echo func1($_POST['callFunc1']);
}

How to do it right?

Either create an array and pass as much as variable you want. otherwise try this:-

 var name= "theName";
    var surname= $('#surname').val();
    $.ajax({
        url: 'SaveEdit.php',
        type: 'post',
        data: { "callFunc1": whichOne,"callFunc2": name},
        success: function(response) { 
        alert(response);
        }
    });

You should add a name to your secund parameter in the AJAX call. Don't forgot to pass it ot your function "func1".

Example:

if (isset($_POST['callFunc1'])) {
   echo func1($_POST['callFunc1'], $_POST['callFunc2']);
}