is it possible to embed a html tag to data table based on ajax json?

is it possible to embed a html tag to data table based on ajax json?

eldhosee2eldhosee2 Posts: 14Questions: 9Answers: 0

jQuery('#datatable-responsive').DataTable({
dom: 'Bfrtip',
lengthMenu: [
[ 10, 25, 50, -1 ],
[ '10 rows', '25 rows', '50 rows', 'Show all' ]
],
ajax: {
url: '../modal/getClients.php',
dataSrc: 'aaData',
method:'POST'
},
columns: [
{ data:'client_name'},
{ data:'client_location'},
{ data:'client_region'},
{ data:'client_remarks'},
{ data:'client_status'}
],
select: true
});

here client_status have values 0,1,2,3 like , then based on that values i want to include an <label class=""></label> into <tr></tr> tag.

is it possible?
How?
or there is any another way?

Answers

  • JunwJunw Posts: 4Questions: 2Answers: 0

    According to mboo2005's comment here

    you can use ajax.dataFilter option

  • eldhosee2eldhosee2 Posts: 14Questions: 9Answers: 0

    i have an idea. please review it, if its bad ,,please suggest a good idea.
    in my database client_status is 0,1,2,3.
    in getClients.php file the corresponding html <label class='' ></label> is encoded in json.

This discussion has been closed.