1
I have a system from which the user by clicking on a link as below opens a PDF file:
<?php
while($listar = mysqli_fetch_object($sql)){
?>
<td class="text-center"><a href="#!" data-id="<?php echo $listar->IdCodCarteiras; ?>" id="link" style="color: #000"><i class="fas fa-address-card fa-lg"></i></a><span id="loading"></span></td>
<?php } ?>
This link is directed to a PHP page where it generates the PDF file through the information passed by the global variable $_REQUEST["key"]
, but I would like to know how to do so that while the PDF file is generated, a gif of loading appears next to the link clicked by the user.
I thought about doing something like this, but I don’t know much about jquery:
$('#link').click(function(){
$('#loading').html('<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>');
var id = $(this).attr('data-id');
$.post('processar-pdf.php', {key: id}, function(retorno){
});
});
But I don’t know if it’s right.
Your question seems to have some problems and your experience here in Stack Overflow may not be the best because of this. We want you to do well here and get what you want, but for that we need you to do your part. Here are some guidelines that will help you: Stack Overflow Survival Guide in English.
– Maniero
Hello Maniero. I adjusted my question. I believe that now it became clearer my doubt.
– user24136