我使用2个div元素作为tabber
1)搜索候选人
2)我的列表。在搜索候选人中,当我选择一些候选人时,该候选人被添加到selected_candidate表并显示在我的列表div中,但要在我的列表中显示它我必须重新加载整页,如何在不重新加载整页的情况下显示它
<div class="tabber" style="width: auto;">
<div <?php if(isset($_POST['submita'])){ echo "class=\"tabbertab tabbertabhide\"";}else{echo "class=\"tabbertab\"";} ?>>
<h3>SEARCH CANDIDATE</h3>
//.....select candidate code.....//
</div>
<div <?php if(isset($_POST['searchsel_list'])){ echo "class=\"tabbertab tabbertabdefault\"";}else{echo "class=\"tabbertab\"";} ?>>
<h3>MY LIST</h3>
<div id="tabr">
<script>
$("td").removeAttr("style");
</script>
<form method="post" action="csearch.php?epage=csearch" name="mylist">
<div class="CSSTableGenerator">
<table id="mylist_remark">
<caption>SELECTED CANDIDATE LIST</caption>
<!-- headings -->
<tr>
<th>REMARK</th>
<th> <input name="delete_sel" id="delete_sel" value="DELETE" type="submit" class="button"/></th>
<th>NAME</th>
<th>CELL NO</th>
<th>STATUS</th>
<th>EMAIL ID</th>
<th>LOCATION</th>
<th>QAULIFICATION INFORMATION</th>
<th>KIND OF WORK</th>
<th>DETAILED CV</th>
</tr>
<!-- /headings -->
<?php
if($mresult_set)
{
if (mysql_num_rows($mresult_set) == 0)
{
echo "<tr>";
echo "<td colspan=\"9\" ><p align=\"center\" class=\"message\"> <blink><span style=\"color:red;\" > NO CANDIDATE SELECTED</span></blink></p></td>";
echo "</tr>";
}
$j=0;
while($data_set1 = mysql_fetch_array($mresult_set))
{
// $i=0;
if($data_set1['ca']=='')
{
$qua="";
}
else
{
$qua=$data_set1['ca'];
}
if($data_set1['cs']=='')
{
$qua="";
}
else
{
$qua.=",".$data_set1['cs'];
}
if($data_set1['cwa']=='')
{
$qua.="";
}
else
{
$qua.=",".$data_set1['cwa'];
}
if($data_set1['completed']=='')
{
$qua.="";
}
else
{
$qua.=", Completed(".$data_set1['completed'].")";
}
if($data_set1['persuing']=='')
{
$qua.="";
}
else
{
$qua.=", Persuing(".$data_set1['persuing'].")";
}
echo "<tr >";
echo "<td><input id={remark{$j}} type=\"text\" class=\"fancyText\" onkeyup=\"writeremark(this.id,{$data_set1['eid']},{$emprid});\" value=\"{$data_set1['remark']}\" maxlength=\"15\" placeholder=\"Write Remark\" /></td>";
echo "<td style=\"text-align:center;\"><input id=\"listrow_sel{$j}\" type=\"checkbox\" name=\"list_sel[]\" value=\"{$data_set1['eid']}|{$emprid}\" /></td>";
echo "<td>{$data_set1['ename']} {$data_set1['lname']}</td>";
echo "<td>{$data_set1['ecell']}</td>";
echo "<td>{$data_set1['eposition']}</td>";
echo "<td>{$data_set1['eemail']}</td>";
if($data_set1['ecity']=='')
{
echo "<td>{$data_set1['ecountry']}</td>";
}
else
{
echo "<td class=\"showmsg\" title=\"Country ={$data_set1['ecountry']}, State = {$data_set1['estate']} \" >{$data_set1['ecity']}</td>";
}
// echo "<td>{$data_set['ecountry']},{$data_set['estate']},{$data_set['ecity']}</td>";
echo "<td>{$qua}</td>";
echo "<td>{$data_set1['other_work1']} {$data_set1['other_work2']}{$data_set1['other_work3']}{$data_set1['other_work4']} {$data_set1['other_work5']} {$data_set1['other_work6']} {$data_set1['other_work7']} {$data_set1['other_work8']} {$data_set1['other_work9']} {$data_set1['other_work10']}{$data_set1['other_work1e']} {$data_set1['other_work2e']} {$data_set1['other_work3e']} {$data_set1['other_work4e']} {$data_set1['other_work5e']} {$data_set1['other_work6e']} {$data_set1['other_work7e']} {$data_set1['other_work8e']} {$data_set1['other_work9e']} {$data_set1['other_work10e']}</td>";
echo "<td><a style=\"cursor:hand;\" href=\"detailcv.php?id={$data_set1['eid']}&flag=0\" target=\"_blank\" ><input style=\"cursor:auto;width:40px;\" class=\"button\" name=\"cv\" type=\"button\" value=\"C V\" /></a></td>";
//echo "<td class=\"edit\" contenteditable=\"true\">Write Remark</td>";
echo "</tr>";
$j++;
}
}
?>
<tr><td colspan="10">
<a href="<?php echo $listurl;?>"><img src="images/pdfdown.jpg" alt="Adobe Doc" width="42" height="42" title="Download List In PDF"/></a>   
<a id="showcand" href="<?php echo $listurl1;?>"><img src="images/excel.gif" alt="Excel Doc" width="42" height="42" title="Download List In Excel "/></a>
<?php ?>
</td></tr>
</table></div>
</form>
</div>
在这张图片中我正在显示tabber,当我点击我的列表时,我可以加载它的表单而不加载整个页面,这样选定的候选人将可见,我知道它可以使用Ajax完成,但我不知道我怎么能在我的代码中做到这一点
答案 0 :(得分:0)
你可以在ajax的帮助下完成。为此,您必须在要添加到列表中的选定候选人上调用ajax函数。
ajax功能演示如下:
function getList(){
$.ajax({
type: "POST",
url: "List.php", // file where you process the list.
data: {name:name1,sda:name2}, // post data you want to pass to the file for processing
success:function(data){
//change the content of your mylist div here
}
});
}
你可以尝试一下。