$.ajax({
type: "POST",
async: true,
url: "<?php echo base_url(); ?>" + "index.php/admin/get_user_privilages",
dataType: 'json',
data: {user_id: user_id},
success: function (res) {
var iHtml = '';
$.each(res, function(key, value) {
iHtml += '<div class="col-md-6">' +
'<div class="checbox-wrapper">' +
'<div class="checbox-wrapper-heading">' +
'<h5>' + value.category_name + '</h5>' +
'</div>' +
'<div class="checbox-wrapper-label">';
$.each(value.sub_cat, function(key2, value2) {
iHtml +=
'<label> <input type="checkbox" onchange="change_privilages('+key2+','+user_id+')" '+value.check[key2]+' class="i-checks"> ' +
value.sub_cat[key2] + '</label>';
});
iHtml += '</div>' +
'</div>' +
'</div>';
});
$('#image_view_panel').empty().append(iHtml);