0

I have a button where when user clicks on it will call a jQuery.post() function to call a PHP file to retrieve large amount of data (almost millions of row) from a database and .append() the returned data into a DataTable.

However every time I refresh the page, whatever that has been .append() disappears.I've been searching for hours now but the answers all suggest the use of local storage or cookies. Now I'm pretty sure storing that large amount of data in the local storage or cookies is either impossible or really inefficient.

I am wondering if there any better way of retaining that large amount of data after every time refresh?

    function getData()
    {
        var tableName = $("#btn").val();

        $.post("getData.php",
        {
            tableName1: tableName

        }, function (data) 
           {  
                //The getData.php will return the values of tr and td
                $("#tableResults").append(data);
           });
    }

<input type="button" value="Customers" id="btn" onclick="getData();" />
<table id="tableResults">
</table>
Ejun
  • 7
  • 4
  • Maybe this will help you: http://stackoverflow.com/questions/10601253/cache-large-volume-of-json-result-on-client-side – Marc Mar 31 '15 at 11:19
  • can you show some of your code ... – Mayank Mar 31 '15 at 11:19
  • Besides the fact that I'm wondering _why_ someone would ever need to display millions of table rows, it is indeed very hard to store that amount of data client-side. I'd say almost impossible, because the LocalStorage limit is 10MB per origin. Why refresh the whole page? Can't you ajax and refresh only the parts that needs to be refreshed? Or fetch only a human-acceptable amount of rows? – Jeremy Thille Mar 31 '15 at 11:26
  • @Mayank add the codes To JeremyThille im using datatable so the values are paged – Ejun Mar 31 '15 at 11:34
  • It just that when user presses F5 the whole page gets refreshed and the appended data gets removed – Ejun Mar 31 '15 at 11:37

0 Answers0