我在函数中有以下代码。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);
?>
当ajax尝试调用get\\u变体时,我总是得到:警告:get\\u variations()缺少参数2
我做错了什么?