0

以下にこのコードを示します。リンクをクリックすると、アラート (linkhref) が表示されます。私の質問は、その (linkhref) を $_post[''] のように php (sample.php) に投稿する方法です。

ありがとう、

    <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:

< a href="files/my_file.zip" class="linklist" name="test">test  insert < /a> 
4

2 に答える 2

0

href: linkhrefあなたの行は、sample.php に$.post()投稿されたデータです。次のように取得します。sample.php

$href = $_POST['href'];
于 2013-08-26T06:22:38.973 に答える
0

sample.php では、次のように href の post 値をキャッチできます。

$linkhref = $_POST['href'];
于 2013-08-26T06:22:53.240 に答える