-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajaxsubcategoryshow.php
83 lines (80 loc) · 2.95 KB
/
ajaxsubcategoryshow.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
session_start();
include_once "management/includes/pro_api_db.php";
$commonFunObj = new CommonFunctions();
$getSubCategory = $commonFunObj->getList("subcategory");
?>
<script>
function statusChange(cid){
var sub_category_id = cid;
parameters = "sub_category_id="+sub_category_id+"&action=subcategoryStatus";
$.ajax({
type: "POST",
url: "ajax_status.php",
data: parameters,
success: function(response){
//alert(response);
if(response == "succ"){
showDataC();
$('#category').val("");
document.getElementById("msg").innerHTML="Update subcategory successfull...";
}
}
});
}
function deleteCategory(cid){
alert("Are you sure to delete category.");
var category_id = cid;
var parameters = "";
parameters = "subcategory_id="+category_id+"&action=subcategoryDel";
//alert(parameters);
$.ajax({
type: "POST",
url: "ajax_delete.php",
data: parameters,
success: function(response){
if(response == "succ"){
showDataC();
$('#category').val("");
document.getElementById("msg").innerHTML="Added category successfull...";
}
}
});
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="admintable">
<tr>
<th width="59" align="left" valign="middle">Sr.No.</th>
<th width="752" align="left" valign="middle">Category Name</th>
<th width="752" align="left" valign="middle">Sub Category Name</th>
<th width="77" align="left" valign="middle">Status</th>
<th width="54" align="left" valign="middle">Edit</th>
<th width="71" align="left" valign="middle">Remove</th>
</tr>
<?php
if($getSubCategory>1){
$sn= 1;
foreach($getSubCategory as $showCategory){
$subcategoryId = $showCategory['category_id'];
if($showCategory['display_status']==1){
$status = "Active";
}else if($showCategory['display_status']==0){
$status = "Deactive";
}
$getCategoryName = $commonFunObj->getList("category",array("id"=>$subcategoryId));
?>
<tr>
<td align="left" valign="top"><?=$sn?></td>
<td align="left" valign="top"><?=$getCategoryName[0]['category_name']?></td>
<td align="left" valign="top"><?=$showCategory['sub_category']?></td>
<td align="left" valign="top" onclick="statusChange(<?=$showCategory['id']?>)"><strong><?=$status?></strong></td>
<td align="left" valign="top"><a href="edit_sub_category.php?scbc=<?=$showCategory['id']?>">Edit</a></td>
<td align="center" valign="top" onclick="deleteCategory(<?=$showCategory[id]?>)"><a href="#"><img src="images/icon-bin.jpg" alt="" width="25" height="25"
border="0" align="absmiddle" /></a></td>
</tr>
<?php
$sn++;
}
}
?>
</table>