Welcome Guest, Not a member yet? Register   Sign In
Ajax VS JQuery VS PHP on Pagination
#1

[eluser][email protected][/eluser]
Hello, everyone:

One simple question,

which one can paginate a database table data without refreshing the page?

Why I ask this question?

I want to optimizing page load process so that when flipping pages of the queried data will be smooth and easy, while it reduce database load by loading page by page in section from database instead of what jQuery pagination does of simply loading everything and hide part of the them.

Thanks!
#2

[eluser]Pert[/eluser]
If you don't want to reload the page then your only option is Ajax.

Loading in everything and then trying to split it with jQuery into pages might work in some cases if you only have couple of pages, but it will make first page load slow.
#3

[eluser][email protected][/eluser]
[quote author="Pert" date="1371289410"]If you don't want to reload the page then your only option is Ajax.

Loading in everything and then trying to split it with jQuery into pages might work in some cases if you only have couple of pages, but it will make first page load slow.[/quote]

Ok, so what if I am not splitting the page load of each page's data, and load everything and sorted then paginate with PHP and Ajax. I found a Ajax Paginate plugin by someone who edited the original PHP CI Pagination library, but I still see the page has been refreshed even when its using Ajax mix with PHP. Does it has to be pure Ajax to make it not reload the page?

Thanks
#4

[eluser]Pert[/eluser]
It does not matter what you use with Ajax, all it does is request information from the server while not refreshing the page. The URL it asks for could be PHP, ASP or just hard coded HTML.

If you say your page reloads, it could be any number of things depending on what you are using.

You don't even need a plug-in, you can use jQuery and do something like this

controller:
Code:
function data($page=null)
{
   echo $page;
}

js:
Code:
$.post('controller/data/1', null, function (result){
   $('#data-holder').html(result);
});

Then just change the controller attribute for right page number.




Theme © iAndrew 2016 - Forum software by © MyBB