admin-ajax.php ” Missing argument 2″ warning

Ajax-calls use the $_POST-variable to submit their arguments to the function. As $_POST['action'] is always used by WordPress Ajax calls (contains the name of the action, obviously 😉 ), PHP only complains over missing argument no. 2.

You can either use the solution provided by Bainternet. If you want to use your function in ajax as well as “pure” PHP context, you can do it this way:

    <?php
    function get_variations($parent_id = false, $item_type = false){

    if(isset($_POST['parent_id'])) {
        $parent_id = $_POST['parent_id'];
        $item_type = $_POST['item_type'];
    }

// etc..

}

This way, PHP will always assume the two arguments given, and you can also use this function without $_POST.