我具有以下代码的JavaScript:
var configuration = [];
configuration["step 1"] = val1;
configuration["step 2"] = val2;
configuration["step 3"] = val3;
configuration["extraData"] = extra_data;
var data = {
action: 'configuration_save',
config: configuration,
};
$.post(ajaxurl, data, function (response) {
alert(response)
});
$_POST['config']
在PHP示出空的。我在传递数组时遇到任何错误。
PHP代码
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
add_user_meta($user_id, "CONFIG", $_POST['config']);
删除'''这里配置:配置,' –
告诉我们'configuration_save'代码 –
@TheFlash:仍然是空的 –