rexhin rexhin - 1 year ago 94
Ajax Question

Load page via PHP vs AJAX

In my dynamic website I first load the

page as a
document structure
and then I make some request to the
PHP server
and insert the data to the page. Is this better than loading all the contents via PHP (
) only? Which method is faster?

Thank You!

Answer Source

This is my understanding:


Step 1: Server sends html page to client.
Step 2: AJAX request is made to the server.
Step 3: Server processes the data.
Step 4: Server responds to the client.
Step 5: Client-side JavaScript changes the page based on the response.


Step 1: Server processes PHP and sends html page.
Step 2: ?????
Step 3: Profit.