I have the following js to process an ajax request:
$('#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);
});
});
And this is my ajax handler function (hopefully my terminology is correct):
add_action('wp_ajax_get_coke', 'get_coke_ajax');
function get_coke_ajax() {
// need to get another_par in here !!!!!!!
die();
}
As you can see, the action is load_post
which is fine, but I need to pass the another_par
parameter to my ajax function so that I can assign its value to a variable and use it for my purposes.