i have this code:
function Save(whichOne){
var name = $('#name').val();
var surname = $('#surname').val();
$.ajax({
url: 'SaveEntry.php',
type: 'post',
data: { "callFunc1": whichOne},
success: function(response) {
alert(response);
}
});
}
I want to do something like this:
function Save(whichOne){
var name = $('#name').val();
var surname = $('#surname').val();
$.ajax({
url: 'SaveEntry.php',
type: 'post',
data: { "callFunc1": {whichOne, name, surname}},
success: function(response) {
alert(response);
}
});
}
But it does not work. The problem is in this line:
data: { "callFunc1": {whichOne, name, surname}},
How do i post multiple values?
EDIT: I am getting this error: Warning: missing argument 2 for func1()
and i have this code:
if (isset($_POST['callFunc1'])) {
echo func1($_POST['callFunc1']);
}