第一個問題刪除表particualr行:我怎麼能使用jquery
當用戶刪除特定行的話,我不得不刪除該行只出刷新頁面。 使用ajax刪除行。我怎樣才能做到這一點
問題二: 其實當過網頁從那天起,到前7天打我正在計算。 但我希望當頁面命中今天我必須檢索前一週 意味着從星期日(2011年11月20日)至星期六(2011年11月20日) 當頁面點擊下一個星期一,因此我必須檢索本週記錄 從星期日2011年11月27)至週六(2011年12月3日)
function authenticate(){
$.ajax({
type: "POST",
url: "authentication.php",
data: $("#login_form").serialize(),
success: function(msg){
if(msg==1){
$('#delete').html("success"); //if success message appear only i have to remove particular row
})
}else{
$('#delete').html("error");
}
},
error:function(msg){
alert(msg);
$('#delete').dialog("close");
}
});
}
<div style='display: none;' id='delete'></div>
<table border="1">
<tr>
<th>Title</th>
<th>Public Id</th>
<th>Pass</th>
<th></th>
</tr>
<?php
$select = $db->select()
->from ('test', '*')
->where ('user_id = ?', 1)
->where ('test.created > DATE_SUB(CURDATE(), INTERVAL 7 DAY)');
$tourDetails = $db->fetchAll ($select);
$i = 0;
foreach ($tourDetails as $row1) {
$i ++;
$title = $row1 ['title'];
$PublicId = $row1 ['public_id'];
if (($i % 2) == 0) {
$rowResponse = prepareRow (true, $title, $PublicId);
echo $rowResponse;
} else {
$rowResponse = prepareRow (false, $title, $PublicId);
echo $rowResponse;
}
}
function prepareRow($flag, $title, $PublicId) {
$rowResponse = "";
if ($flag) {
$rowResponse .= '<tr class="even">';
} else {
$rowResponse .= '<tr class="odd" >';
}
$rowResponse .= '
<td> ' . $title . ' </td>
<td> ' . $publicId . ' </td>
<td><p><a onclick=openDialog("'. $PublicId .'","delete") href="#" id="dialog_link">
Delete </a></p>
</td>';
return $rowResponse;
?>
</table>
我不得不刪除沒有第二行用戶刪除的行 – vvr
我只是給你一個例子......你可以找到已刪除的行的行號,並把那個,而不是2或assing一個ID的行一旦刪除,然後使用vikky的方法。 – Shomz
您可以使用該特定點擊元素的索引。 – punit