shaik shaik - 1 year ago 122
JSON Question

Append HTML Table To Json Response In Codeigniter

Hi I Want to draw a table with json data which is my code I am getting correct json response but not able to draw a table in popup, Which is my Code

$(document).on('click','.details', function(){
var student_id = $(this).attr("id");
url: "<?php echo base_url(user/details);?>",
type: "post",
data: {id:id},
success: function(data)
$.each(json, function (i,data) {
$("#fees_table").append( "<tr><td>" + + "</td><td>" + data.first_name + "</td><td>" + data.last_name + "</td><td>" + data.user_name + "</td></tr>");

} );

Which is my controller

Answer Source

Change this

$.each(json, function (i,data) {


var data = $.parseJSON(data);
$.each(data, function () {

If you getting correct response then it should work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download