rexhin rexhin - 5 months ago 17
Ajax Question

Load page via PHP vs AJAX

In my dynamic website I first load the

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

Thank You!

Answer

This is my understanding:

index.html

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.


index.php

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

Comments