rstaib / jquery-bootgrid

Nice, sleek and intuitive. A grid control especially designed for bootstrap.
http://www.jquery-bootgrid.com
MIT License
972 stars 364 forks source link

how display image from database using jquery ajax ? that received from php json encode #368

Open husen13 opened 7 years ago

husen13 commented 7 years ago

hello sorry to ask,but i am dying to know the answer,i want to display image in my bootgrid table from database,and what i know is that i have to use formatters ? but HOW ? that's my question,i got some example of my bootgrid table and side server code " var productTable = $('#data').bootgrid({ ajax: true, rowSelect: true, post: function() { return{ id: "b0df282a-0d67-40e5-8558-c9e93b7befed" }; }, url: "load_data.php", formatters: { "commands": function(column, row) { return "<button type='button' class='btn btn-warning btn-xs update' data-row-id='"+row.book_id+"'>Edit</button>" + "&nbsp; <button type='button' class='btn btn-danger btn-xs delete' data-row-id='"+row.book_id+"'>Delete</button>"; }, } });

here is my serverside code : $query .= " SELECT book.data_id, category.category_name, book.data_name, book.data_quotes, book.image FROM product INNER JOIN category ON category.category_id = book.category_id ";

i know that this question is off topics because it's about issues or something like that,but REALLY,i need to know,and here is the thing,i receive the data from my php file in json data type ('json_encode'),that make me in much worse position,soooo,please help me

atishagrawal commented 6 years ago

It is better to fetch Image Path from the database inside json_encode. On the front end, (javascript), render the cell using the imagepath inside an img tag of HTML