Pass value by link

Asked

Viewed 47 times

0

I need to send a value through a link to another page:

<li><a href="" onclick="getPasta()" id="icons"><?php echo $this->translate('Download');?></a></li>

I tried to use this code to send:

<script type="text/javascript">
        function getPasta(){
            var id = $(this).attr('id');
            $.post(
                    "../download/index.phtml", 
                    { pasta: "id" }
            );
        }
</script>

However it is not working. I also ask how I would capture this value on my landing page, because I need the value pasta:id is in a PHP variable.

1 answer

0


Kind of :

<li><a href="../download/index.phtml?pasta=id_7" id="icons"><?php echo $this->translate('Download');?></a></li>

To get the value:

$peguei = $_GET['pasta'];

Browser other questions tagged

You are not signed in. Login or sign up in order to post.