Does anyone have a complete start-to-end set of steps taken when making an ajax call? is it different then a http request? Via perception, it seems an ajax populated web page takes more time then a php populated one: both accessing the same db, same # of records, same display, difference being in-line php to render the form prior to sending and jquery reading json and populating the form...could it be the rendering?
An Ajax call performs a HTTP request, so no, it isn't "different" from a HTTP request, though the Ajax HTTP request is used differently from a page retrieval for rendering.
If a page is populated via Ajax, yes, it will be much slower than a page that's pre-populated on the server side, because the Ajax-populated page runs a separate HTTP request for each populated element, and moreover those generally cannot all run at once.
The start-to-end is, at some high level of abstraction:
- Set up an Ajax object
- Initiate the Ajax HTTP request
- Wait for the Ajax HTTP request to complete
- Unpack and use the results of the Ajax HTTP request
Correct.
In order to fetch data from a different page it takes a little more work than to simply refresh the page, hence why a majority of the web does not run on AJAX. This is because when you refresh the page, the browser makes the HTTP request, instead of via AJAX where you make the request.
But, I would take a look at jQuery (jquery.com) to ease your troubles a little bit. It has some pretty easy functions that will ease the processenter code here
of going and grabbing new pages via AJAX.
If you do go the route of jQuery, I'd also look at parsing things in JSON. jQuery makes it fairly easy to do, and learning how to parse JSON is a really nice skill for passing structured data to Javascript.