<em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em> <em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em> <em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em> <em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em> <em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em> <em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em>
Jquery:
//也可以用类 $(".sui").bind('click', function(event) $("em").bind('click', function(event) { build = $(this); var phone = $(this).attr("value"); $.ajax({ url: "<?php echo SITE_ADMIN_URL . '/member/get_phone/'; ?>"+phone, type: 'Get', dataType: '', success:function(result){ build.html("<em>"+result+"<em>"); } }); });