jQ+Ajax+PHP 简单实例

预览图:

index.php

<script src="http://localhost/a/jquery.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
  $(".pop").click(function(){
  var gmemo=$(this).attr("memo");
  var gid=$(this).attr("id");
  htmlobj=$.ajax({url:"run.php",
  async:false,
   data: { memo: gmemo, id: gid }
  });
  $("#combox-inside").html(htmlobj.responseText);
  });
});
</script>
<a href="#" class="dh pop" memo="0" id="1">点击这里</a>
<div id="combox-inside"></div>

run.php

<?
$memo=$_GET['memo'];
$id=$_GET['id'];
echo "获取的memo:".$memo."<br />";
echo "获取的id:".$id;
?>

jquery.js自己上网下载一份即可!jQ的相对于js的简单很多

相关文章:

js+Ajax+PHP 简单实例

jQuery ajax - post() 方法

posted @ 2013-03-27 23:49  tinyphp  Views(1784)  Comments(0Edit  收藏  举报