I have a form and the following requisition:
jQuery('#cadastro').submit(function() {
var dados = jQuery(this).serialize();
jQuery.ajax({
type: "POST",
url: "/cadastrar",
data: dados,
beforeSend(xhr) {
modalOpen();
},
success: function(data) {
modalContent(data);
}
});
return false;
});
In my index.php where the application is loaded I have:
$app->post('/cadastrar', function(){ });
How do I intercept this $ _POST data in my method within the route register?