我有以下js来处理ajax请求:
$(\'#someelement\').click(function() {
var cokeValue = \'coke\';
var data = {
action: \'load_post\',
another_par: someVar
};
jQuery.post(ajax_object.ajax_url, data, function(response) {
alert(response);
});
});
这是我的ajax处理函数(希望我的术语是正确的):add_action(\'wp_ajax_get_coke\', \'get_coke_ajax\');
function get_coke_ajax() {
// need to get another_par in here !!!!!!!
die();
}
正如你所见,行动是load_post
这很好,但我需要通过another_par
参数,以便我可以将其值赋给变量并将其用于我的目的。