Any ideas as to why I'm getting a 400 Bad Request from this?
JS
$(document).on('keyup', '#typeahead_input', function() {
let typeahead_query = $('#typeahead_input').val();
let post_data = {
'data' : typeahead_query,
'action' : 'typeahead_function'
};
$.ajax({
method: "POST",
url: '/wp-admin/admin-ajax.php',
data: post_data,
dataType: "html",
success: function(ret){
console.log(ret)
}
});
});
PHP
add_action( 'wp_ajax_typeahead_function', 'typeahead_function' );
function typeahead_function() {
return 456;
}