Hi guys i'm using server side processing to read the database table and convert the records into Json file, and pass it to the database table to display data.
read database and convert it into json code:
Route::get('banner/list/banners/json/{id}', function () { $banner = DB::table('banner_creatives')->where('Id','=','53')->get(); $recordsTotal = count($banner); $data['draw'] = 1; $data['recordsTotal'] = $recordsTotal; $data['recordsFiltered'] = $recordsTotal; $data['data'] = $banner; return Response::json($data); });
Json output:
{"draw":1,"recordsTotal":1,"recordsFiltered":1,"data":[{"id":1,"bId":26,"cId":53,"bName":"32_32_53.jpeg","storageType":"url","width":32,"height":32,"weight":1,"imageURL":"localhost:8000\\\/banner\\\/view\\\/32_32_53.jpeg","clickURL":"","created_at":"2015-01-26 12:32:28","updated_at":"2015-01-26 12:32:28","deleted_at":null}]}
as you can see on this json i have the image Url that i want to display it on the table.
JavaScript code:
$(document).ready(function() { var table = $('#banner').DataTable( { "processing": true, "serverSide": false, "ajax": "banners/json/53", "columns": [ { "data": "id" }, { "data": "bannerId" }, { "data": "campaignId" }, { "data": "bannerName" }, { "data": "width" }, { "data": "height" }, { "data": "imageUrl" } }); });
Datatable code:
id Banner Id Campaign Id Banner Name Width Height Image/Banner id Banner Id Campaign Id Banner Name Width Height Image/Banner
On the last column it displaying the image URL but is not what i want, i want to display the usually image on the datatable using the URL, if it possible.
Thank you in advance.