|
![](/images/resource/spacer.gif) |
|
จะกดลบแล้วให้อยู่ในหน้าเดิม ไม่ขึ้นแท็บใหม่ยังไงคะ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Code (PHP)
<?php
$db=new mysqli('host', 'user', 'psw', 'dbname');
if(isset($_POST['type'])){
switch($_POST['type']){
case 'delete':
$db->query($sql='delete from table where id='.intval($_POST['id'])) or die("$sql<br>" . $db->error);
echo 'OK'; break;
case 'insert': //////
echo 'OK'; break;
case 'update': //////
echo 'OK'; break;
}
exit;
}
?>
<!doctype html><html><head>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$('button').click(function(e){
var tr = $(this).parent().parent();
$,ajax({ type: 'POST', data: {type: 'delete', id: $(this).data('id') }}).done(function(msg){
if(msg == 'OK') $(tr).remove(); else alert(msg);
});
});
});
</script>
</head>
<body>
<table>
<tr><td><button type="button" data-id="1"></td></tr>
<tr><td><button type="button" data-id="2"></td></tr>
</table>
</body>
</html>
|
ประวัติการแก้ไข 2015-08-02 11:34:54
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-08-02 08:51:52 |
By :
NewbiePHP |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ขอบคุณพี่มากนะคะ -/\-
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-08-02 10:02:08 |
By :
maiahoo |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 02
|