通过JQuery $ .ajax将多个JavaScript对象传递给PHP

I have a object recipe that has multiple params

This works, I passed the object thru ajax to my php

 $.post('addRecipe.php', recipe,  function () {});

And this works, php getting the params

function getParam($param) {
    if (!empty($_POST[$param])) {
        return $_POST[$param];
    }
    return 'UNKNOWN';
}

$name = getParam('name');
$phone = getParam('phone');

Now I want to pass 2 objects the recipe that has multiple params and recipeID that has 1 param

  $.post('editRecipe.php', {recipe: recipe, recipeID: recipeID},  function (){});

how can i get it with php?

Just add another parameter with a different key. Pass it to the function from the post valur. Like you're already doing with recipe

if i understand your requirements correctly you can try this

getParam('recipe') will return recipie object and

getParam('recipeID') will return recipeID