如何以表格格式将数组附加到div

时间:2016-09-06 07:40:17

标签: php jquery

Html:

<div id="result">
</div>

Ajax电话:

$.ajax({
    url: "<?php echo get_base_url(); ?>admin/test_pad/test_get_car_availability_record",
    type : 'POST',
    data: file_data,
    async: false,
    cache: false,
    contentType: false,
    enctype: 'multipart/form-data',
    processData: false,
    success:function(response)
    {
      $('#result').append(response);
    }   
});

作为对ajax的回应,我得到格式的数组:

Array ( [0] => Array ( [car_availability_id] => 1 [0] => 1 [car_id] => 1 [1] => 1 [car_category_id] => 1 [2] => 1 [from_date_time] => 2016-09-06 00:00:00 [3] => 2016-09-06 00:00:00 [to_date_time] => 2016-09-07 00:00:00 [4] => 2016-09-07 00:00:00 [is_booked] => no [5] => no [booking_id] => 455 [6] => 455 [from_destination_exists] => no [7] => no [from_destination_id] => 5 [8] => 5 [to_destination_exists] => no [9] => no [to_destination_id] => 546 [10] => 546 [spot_fare] => 0.0000 [11] => 0.0000 [fare] => 6 [12] => 6 [dt_modified] => 2016-09-06 12:54:02 [13] => 2016-09-06 12:54:02 [dt_created] => 2016-09-06 12:54:02 [14] => 2016-09-06 12:54:02 ) )

但响应应以表格格式打印。 我尝试了很多东西但没有得到适当的输出。

0 个答案:

没有答案