是否可以提交表單而不刷新並隱藏當前div,顯示隱藏的div。提交表單本身沒有頁面刷新並隱藏/提交後顯示div
我嘗試使用下面的代碼提交表單並重新加載頁面。
<form method="post" name="searchfrm" action="schedule.php" >
<div><input type="text" placeholder="Patient Lastname" class="pName" id="pName" name="pName" /></div></br>
<div><input type="text" placeholder="Surgeon Name" class="sName" id="sName" name="sName" /></div></br>
<div>
<span><input type="text" placeholder="mm" class="mm" name="mm" /></span>
<span><input type="text" placeholder="dd" class="dd" name="dd" /></span>
<span><input type="text" placeholder="yyyy" class="yyyy" name="yyyy" /></span>
<span><input type="button" class="sButton" id="sButton"/></span>
</div>
<!-- Search Results -->
<div id="searchDiv" class="searchDiv" style="display:none;">
<?PHP
$dateVal = $_POST["yyyy"]-$_POST["mm"]-$_POST["dd"];
$sName = $_POST["sName"];
$pName = $_POST["pName"];
echo "dateVal".$sName;
[email protected]_query("SELECT * FROM issio_patient_procedures WHERE procedure_date='$dateVal' AND asc_id='$ascId' AND surgeon_name='".$sName."' ");
if(@mysql_num_rows($ser_val)>0)
{
$se_count=0;
while([email protected]_fetch_assoc($ser_val))
{
$se_count++;
echo $se_count_det["surgeon_name"];
}
}
?>
</div>
<!-- Search Results End -->
<div class="scroll" id="scroll" style="display:block;">
<div class="dateHeader">
Some content....
</div
</div
的[提交表單,而不刷新頁面]可能重複(http://stackoverflow.com/questions/ 2866063/submit-form-without-page-reloading) – jeroen 2012-03-14 23:13:42