I am attempting to create an AJAX call to pass custom taxonomy into my WP_Query but I am getting 400 (Bad Request). I believe my data array is built correctly so I am not sure what's causing it. Does anything look off here? Is there a way for me to get a more detailed error of why it is returning error 400?
$.ajax({
type:'POST',
url:ajaxUrl,
data: {
taxonomy: 'products',
slug: 'shirts'
},
beforeSend:function(xhr){
},
success:function(data){
$('#response').html(data); // insert data
}
});
I console logged ajaxUrl and I am getting the correct path to admin-ajax.php so I know that's not the issue. I think it has to have something to do with data.