Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

AJAX and JS-render

$
0
0

Hi,

I'm new to (web)dev so sorry for that. I created a database on my webserver, connected it/fetch data and render it into datatables (with images) see: http://eep.fifaplanet.eu/convertcsv.php

I just filtered the selection to ~200 entries. If I just select all entries (~20.000) the page loads for 2 minutes and needs much ressources.

I was looking around for a solution and saw each time "AJAX" and "serverside". There examples how to connect/fetch my database with AJAX but can I just render the rows with my current javascript function?
This is how I do it currently:

$(document).ready(function() {
    $('#example').DataTable( {
        "columnDefs": [
            {
                "targets": [ 0 ],
                "visible": false,
            },
            {
                "targets": [ 1 ],
                "data": "playerid",
                "render": function (data, type, row, meta) {
                return type === 'display'
                  ? '<div class="image-plus-text"><img style="width:64px" src="/Minifaces/' + row[0] + ".png" +  '"/>'+ "<br>" + data  + '</div>'
                  : data;
      }

[...]

How can I do it afterI'm using AJAX?


Viewing all articles
Browse latest Browse all 81728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>