javascript - How to split the success output from an Ajax post? -


i have ajax post php file returns table on success. use whole success output fill div in main html page. pretty simple. however, result table huge , takes long display results @ once or fails(google chrome 'aw snap error').

so, split output , load user scrolls down.

let's say,

ajax success got 1000 results , want fill first 20 , display rest user scrolls down.

        $.ajax({             url:"xxxxxx.php",              data: { xxxxxxxxx },             type: "post",              success:function(result){                 document.getelementbyid("cdr").innerhtml =  result;         }); 

you should 20 records each request. loading records not approach. imagine situation when result contains 1 million records?

to so, in ajax's data setting, can add parameter called "page_number" , increase each ajax request javascript, on server processing (your .php file), take "page_number" parameter , process result taking based on current "page_number".


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -