I have the following code in functions.php
<script type="text/javascript">
var post_id = "1055"; // hardcoded post id for testing purposes
var type = "some_type";
var data = {action: "get_variations", parent_id: post_id, item_type: type};
jQuery.post("/wp-admin/admin-ajax.php", data, function(response){
alert(response);
});
</script>
<?php
function get_variations($parent_id, $item_type){
// etc..
}
add_action('wp_ajax_get_variations', 'get_variations', 10, 2);
?>
When ajax tries to call get_variations I always get:
Warning: Missing argument 2 for get_variations()
What am I doing wrong?
