Hi, guys, how do I get an alert when the https request does not find the identification in a database by using an api rest? What I am doing is looking for an ID when it is found, it shows me on a table that information also a pdf, but when it is not found it shows me the table and the empty pdf (I tested by console returns a null) what I want is to block that table and the pdf and only show me an alert "Identification does not exist". Thanks for your reply.
PHP code:
if (isset($_POST['submit'])) {
$ruc=$_POST['ruc'];
$url = 'https://......'.$ruc;
$json = file_get_contents($url);
$datos = json_decode($json,true);
$rucs=$datos["NUMERO_RUC"];
echo'<br>';
echo'<div class="c">';
echo '<table class="table">'
.'<tr style="text-align:center">'
.'<td style="background:#EEE"><b>Número de ruc</b></td>'
.'<td style="background:#EEE"><b>PDF</b></td>'
echo '<tr style="text-align: center">'
.'<td>' . $rucs. '</td>'
.'<td>' . '<a href="pdf/pdf.php">PDF</a>'. '</td>'
echo '</table>';
echo'</div>';
}