I am facing an issue with WP AJAX.
jQuery.ajax({
type: 'POST',
url: spaceajax.ajaxurl, // this contains my admin ajax URL
data: {
"event_id" : 1,
"space_id" : 1,
"booking_id": 1,
'action' : 'requestContract'
},
success: function(result) {
alert("Success!");
}
});
in my functions.php
function requestContract(){
echo "Checkpoint"; die;
}
add_action( 'wp_ajax_requestContract', 'requestContract' );
add_action( 'wp_ajax_nopriv_requestContract', 'requestContract' );
However, I am encountering a 400 Bad Request error. Any ideas on what could be causing this?