我想根据我的点击显示一个临时 div。例如,当我单击第二行时,临时 div 将显示在第二行之后。
这是我的看法:
<div id="sidetree" align="center">
<div id="sidetreecontrol">
<a href="?#">Collapse All</a> | <a href="?#">Expand All</a>
</div>
<ul class="treeview" id="tree">
<li class="expandable">
<div class="hitarea expandable-hitarea"></div>
<a href="?/index.cfm">These are the Sponsors Of <?=$sponsor_id;?></a>
<ul style="display: none;">
<?php
foreach($Level1Details->result() as $row){
?>
<li id="sponsor_id"><label alt="<?=$row->user_id?>"><?=$row->user_id;?></label></li>
<ul><div id="levelTwo"></div></ul>
<?php } ?>
和 JS:
$(document).ready(function(){
$('#sponsor_id label').live('click',function() {
var sponsor_id=$(this).attr("alt");
alert(sponsor_id);
var js={"sponsor_id":sponsor_id};
$.post(url+"loyalty/level2", js, function(data){
$('#levelTwo').html(data.result);
}, "json");
});