javascript - get the value of alert and post to php -
i have code below, if click on link, alert (linkhref) appear, question is, how post (linkhref) on php (sample.php) $_post[''];
thanks,
<script language="javascript" type="text/javascript"> $(document).ready(function() { $('.linklist').click(function(){ var linkhref=$(this).attr('href'); alert (linkhref); $.post("sample.php", { href: linkhref } ); }); }); </script>
html:
< href="files/my_file.zip" class="linklist" name="test">test insert < /a>
the line href: linkhref
in $.post()
data posted sample.php
, in sample.php, as:
$href = $_post['href'];
Comments
Post a Comment