我有一個頁面有一個表格。它顯示選擇選項時,選擇一個選項用戶單擊按鈕,它運行updatephp.php查詢更新。我需要動態更新選擇並在屏幕上顯示「更新」或「無結果」等成功/錯誤消息,我該如何實現這一點。我不是很擅長阿賈克斯,請有人引導我。表格動態刷新php和ajax
displaytable.php
<form method="POST" action="choosecake.php">
<select id="bakeryid" name="bakeryid">
<option value="">Select</option>
<?php
$sql = "SELECT bakeryid, datefrom FROM cakes";
$sqlresult = $link->query($sql);
$sqllist = array();
if(mysqli_num_rows($sqlresult) > 0) {
while($row = mysqli_fetch_array($sqlresult))
{
echo "<option value=".$row['bakeryid'].">".$row['datefrom']."</option>";
}
$sqlencode = json_encode($sqllist);
echo $sqlencode;
} else {
echo 'No Results were found';
}
?>
</select>
<input type="hidden" value="<?php echo $bakeryid;?>" name="bakeryid"/>
<input type="submit" value="Submit" name="submit"/>
</form>
我在這裏看不到ajax – cameronjonesweb 2015-02-08 23:45:07