I have this ajax and a page called test.php that gets a value, I would like to know if my ajax is right and this value is being fetched inside the test.php page
<script>
$('input[name=valor]').click(function() {
var campoRadio = $('input[name=valor]:checked').val();
$.ajax({
method: "POST",
data: { campoRadio: campoRadio },
url: "test.php",
dataType: "php"
});
alert(campoRadio);
});
</script>
test.php
$valor = $_POST["campoRadio"];