-
Notifications
You must be signed in to change notification settings - Fork 3
/
manage_comment.php
63 lines (59 loc) · 1.55 KB
/
manage_comment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php include 'admin/db_connect.php' ?>
<?php
if(isset($_GET['id'])){
$qry = $conn->query("SELECT * FROM forum_comments where id=".$_GET['id'])->fetch_array();
foreach($qry as $k =>$v){
$$k = $v;
}
}
?>
<div class="container-fluid">
<form action="" id="update-comment">
<input type="hidden" name="id" value="<?php echo isset($_GET['id']) ? $_GET['id']:'' ?>" class="form-control">
<div class="row form-group">
<div class="col-md-12">
<label class="control-label">Comment</label>
<textarea name="comment" class="text-jqte"><?php echo isset($comment) ? $comment : '' ?></textarea>
</div>
</div>
</form>
</div>
<script>
$('.text-jqte').jqte();
$('#update-comment').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'admin/ajax.php?action=save_comment',
method:'POST',
data:$(this).serialize(),
success:function(resp){
if(resp == 1){
alert_toast("Data successfully saved.",'success')
setTimeout(function(){
location.reload()
},1000)
}
}
})
})
$('.delete_comment').click(function(){
_conf("Are you sure to delete this comment?","delete_comment",[$(this).attr('data-id')],'mid-large')
})
function delete_comment($id){
start_load()
$.ajax({
url:'admin/ajax.php?action=delete_comment',
method:'POST',
data:{id:$id},
success:function(resp){
if(resp==1){
alert_toast("Data successfully deleted",'success')
setTimeout(function(){
location.reload()
},1500)
}
}
})
}
</script>