将Jquery变量通过url传递给php

时间:2017-02-25 05:52:07

标签: php jquery

你能告诉我怎样才能实现这个目标

 $(document).ready(function(){
    id = "user";
 $( '#login' ).html( "<a href = http://localhost/Misc/Receive.php? 
id=+id>Test </a>" );

Receive.php     $ val = $ _GET ['id'];

echo($val);

想要将存储在变量id中的值传递给receive.php

1 个答案:

答案 0 :(得分:2)

报价不正确,请将您的字符串更改为:

$( '#login' ).html( "<a href = http://localhost/Misc/Receive.php?id="+id+">Test </a>" );