PHP与jquery前后台交互的小程序


1
<!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset = "utf-8"> 5 <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> 6 <script> 7 $(function(){ 8 $("#button").click(function(){ 9 $.post("index8.php",{"a":"hello","b":"世界"},function(data,status){ 10 alert(data); 11 }); 12 }); 13 }); 14 </script> 15 </head> 16 <body> 17 <input type = "button" id = "button" value = "button" name = "button"> 18 </form> 19 </body> 20 </html>
1 <?php
2 $a = $_POST['a'];
3 $b = $_POST['b'];
4 $c = "d";
5 $$c = "world";
6 echo $d;
7 echo $a;
8 ?>

作为自己的一个小练习吧!

posted @ 2015-08-30 19:42  邻家小书童  阅读(441)  评论(0编辑  收藏  举报