I know how to send data from PHP to the react component but how do i send an id selected in a menu from the react component to the PHP file?
$.ajax({url: '/file.php', type: 'POST',
dataType: 'json',
success: response => {
console.log(response)
}});
And in the PHP file:
$testid= //how do i send a variable here
$results = $db->statement("SELECT * FROM tablename where id='testid");
echo json_encode($results);