Javascript-is it better to use ajax requests to call website page content or use php to generate static pages?

Source: Internet
Author: User
I have some questions about website development recently. I would like to ask you: The website uses the Empire CMS, and the previous news sections use php. Each news generates a static page for users to access; another forum is developed later, which is also the content posted by the user. then others click to view the content, but click it to view the content... I have some questions about website development recently. please refer to the following questions:

  1. The website uses the Empire CMS, and the previous news sections are all written in php. each piece of news generates a static page for users to access;

  2. Another forum was developed later, which is also the content posted by the user. then others click to view the content, but after clicking it, the content is retrieved in the background using ajax and then presented to the user;

Which of the following methods is better or worse?
What I know is the first method. if there are more website content in the future, refreshing the content page in the background will be a waste of time. if there are too many visitors in the second method, each ajax call may put a lot of pressure on the database.

Reply content:

I have some questions about website development recently. please refer to the following questions:

  1. The website uses the Empire CMS, and the previous news sections are all written in php. each piece of news generates a static page for users to access;

  2. Another forum was developed later, which is also the content posted by the user. then others click to view the content, but after clicking it, the content is retrieved in the background using ajax and then presented to the user;

Which of the following methods is better or worse?
What I know is the first method. if there are more website content in the future, refreshing the content page in the background will be a waste of time. if there are too many visitors in the second method, each ajax call may put a lot of pressure on the database.

User comments mainly require seo. otherwise, ajax is recommended. for other users, this is not the core and may end reading when the comments are not loaded, bandwidth and traffic are wasted.

The smaller the html, the faster the loading.

Static pages are recommended for core website content, mainly for search engines. ajax can be used for comments that are irrelevant.

Cache technology can be used after static news pages are generated, in this way, if the cache file does not expire after you click view, you do not need to use PHP to generate HTML page loading data again, which can increase the page access speed. Otherwise, you can generate a page through PHP again. now, generally, if a news information carrier like this cannot be changed once every one hundred years, you can consider using partial caching. for comments and click states that are easy to change, you can load data information through ajax. As for the timeliness of comments, depends on your specific needs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.