Question: I have several update methods in a javascript file, used for updating my ajax application, like so:

```
function updateByPk(layer, pk) {
   url = "get_auction.php?cmd=GetAuctionData&pk="+pk+"&sid="+Math.random();
   update(layer, url);
}

function updateByQuery(layer, query) {
   url = "get_records.php?cmd=GetRecordSet&query="+query+"&sid="+Math.random();
   update(layer, url);
}

function updateByPage(layer, query, pg) {
   url = "get_records.php?cmd=GetRecordSet&query="+query+"&pg="+pg+"&sid="+Math.random();
   update(layer, url);
}

```

I am wondering if it would be more efficient to do things like pagination and such strictly through php, simply by reloading the page, rather than using an ajax method. I am not sure which method is more efficient, or if there are advantages and disadvantages to each.

Answer: 
Paging with AJAX advantages:

* Potentially less transmitted data, which means faster page loads and less bandwidth usage.
* Smoother user experience

Paging without AJAX advantages:

* Back and Forward buttons will work in the browser
* You can have the URL of a specific page (although you can do this with AJAX too with the page.php#pagenumber trick)
* Perhaps a bit easier to write and maintain
It depends on your definition of efficiency. Loading new content through AJAX will net less bytes going over the wire, but might be more strenuous on your server if you can't cache the dynamic content into static files (which I assume you would when reloading the page). However relying on AJAX too much might cause your pages to be less accessible for users whose browsers don't support javascript (they exist) and might hurt your sites capability to be indexed by search engines. A best of both worlds scenario would be to let the links point to a reloaded page, but override that behaviour with javascript to load in new content through AJAX.