嗨,我使用的PHP,我使用的是Ajax我從數據庫中檢索數據,無需重新加載頁面我現在正在同一頁面上獲取數據我希望當我得到的數據我以表格格式檢索那麼當我點擊時有更新按鈕在更新按鈕的新形式應打開如何在點擊按鈕中打開新表單?
這裏是代碼
的index.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function fun()
{
var exam=new XMLHttpRequest();
exam.onreadystatechange=function()
{
if(exam.readyState==4)
{
document.getElementById("res").innerHTML=exam.responseText;
}
}
exam.open("GET","rat_test.php?name=pramod",true);
exam.send(null);
}
</script>
</head>
<body>
<form action="" method="post" id="form" name="form">
<table>
<tr>
<td></td><td><input type="button" onclick="fun();" value="getvalue" />
</td></tr>
<div id="res"></div>
</table>
</form>
</body>
</html>
rat_test.php
<table border="1">
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
</tr>
<?php
include("connection.php");
$sel="select * from info";
$res=mysql_query($sel);
while($fet=mysql_fetch_array($res))
{ ?>
<tr>
<td><input type="checkbox" name="users[]" value="<?php echo $row["id"]; ?>" ></td>
<td><?php echo $fet['id']; ?></td>
<td><?php echo $fet['name']; ?></td>
</tr>
<?php }
?>
</table>
<form action="" method="post" id="form" name="form">
<table>
<tr>
<td></td><td><input type="button" onclick="fun()1;" value="Update" />
</td></tr>
</table>
</form>
在這裏test_rat.php一個更新按鈕可我想打開一個新的窗體上更新按鈕按鈕
我怎樣才能做到這一點
任何幫助將不勝感激
要麼得到使用Ajax的新的形式或者用JavaScript的飛行 – Shadow 2014-09-04 06:12:38
創建我怎麼能拿ü可以請寫一些代碼 – 2014-09-04 06:13:37