Is web page rendering good in php or ajax mode?

Source: Internet
Author: User
Now, the company's management background page basically uses ajax to render the page. if JavaScript is disabled, the whole page will be discarded. there are too many Page interfaces. for example, a paging function is completely rendered by js, I think php and ajax are the best to mix. you can give your comments. Now, the company's management background page basically uses ajax to render the page. if JavaScript is disabled, the whole page will be discarded. there are too many Page interfaces. for example, a paging function is completely rendered by js, I think php and ajax are the best to mix. you can give your comments. Reply content: 1. up to today, almost no one will ban JavaScript.
2. php generates all the code, which must be faster than generating only the framework and then ajax. The reason is that in both cases, the number of K data transmitted by your network cable is basically the same. if js executes innerHTML, it will modify the dom, causing re-painting and re-arrangement, the cost is relatively high. Even if php is only responsible for the box, but generally php projects use the template engine, even if the box is provided and the template engine needs to be used, the template engine processes the box and all content, almost no time zone. If the data volume is large, the advantage of ajax is that data can be downloaded in segments, which is faster than php.
3. ignoring php is faster than ajax. The difference between php and ajax is that php is used only when there are no necessary rules.
Ajax is always "secure" Frequently updated "Batch data in the format" and "data cache" are related, and the user has no desire to view the old data. that is to say, the user is not interested and there is no need to click the back key to view the old data. Ajax does not support the backend key by default. if you want to implement backend, you need to do a lot of work.
That is to say:
A. If the captured data is sensitive, do not use ajax. if not, use ajax. If you capture not the batch data in the format, but other things, such as capturing a video address, there is only one, and ajax is not necessary. If you predict that the user will view a large amount of data, use ajax to capture a batch of data (or use php to output the first batch of data), then the background will continue to capture other data and then cache it, in this case, ajax is used.
B. If your page is in static state after being displayed (without frequent data updates), you must use php. (If the page shows the date of the day, yesterday is the 15th day, today is the 16th day, it is also considered that the data is static. If your user name is displayed at a location, it is also considered that the data is static .)
C. If your page is not in the static data state after it is displayed, that is to say, during the tens of seconds of viewing the page, the server database has a large volume of data updates, and you need to see these updates immediately, so you can use ajax. Or you may need to keep your page open for half an hour or one hour without closing, and you need to see data updates at any time. you must use ajax.
From the perspective of my theory above, in general, it is right for your company to use php in a large amount and add a lost ajax.
Some people say that ajax is used to obtain paging information, isn't it beautiful? Here the truth is actually the same. the list can be regarded as batch data in the format, and the cache is conducive to page turning, so ajax is supported. However, it is possible that the list page is updated slowly. a new page is added in a few days or weeks, so you can consider php. So this time depends on the situation.
If a web page shows a small amount of 30 or 40 pieces of batch data, today is the data, and tomorrow is the data, but it hasn't changed yet, even though it complies with the format of batch data ", but php is also recommended, and ajax is not recommended. That's why I said that php can be widely used in the company's intranet.

Php has nothing to do with html generation. if the data on an html page is always updated, of course, ajax is not a problem. There is a reason for the company to do this. in the future, there will be no need to change the background of ios and android on the mobile phone end without compatibility. now I don't know what these answers are...
The subject said it was a management system, which is obviously used internally.
This type of application features a high level of interaction, low access speed, and low development investment resources. In this case, the front-end architecture (angular, vue, react…) is used ......), Obviously, in this scenario, this is the optimal solution. in this way, the development efficiency is higher and the maintenance is more comfortable.

If such an application uses php to directly expose the page, add jquery and jquerytable for interaction. After maintenance, you will want to die. if you add a new management panel, you will have to write hundreds of lines of JavaScript code using ajax to render the page, this is called the cloud-based web architecture. Because mobile development projects account for major markets (such as micro-website development), the cloud structure is better than hybrid rendering without considering SEO. This is mainly due to three aspects of software engineering development: flexibility, scalability, and reusability.
1. reusability. If you use hybrid rendering, the front-end rarely uses the framework. it is just a CSS framework like bootstrap, and it is difficult to build the underlying architecture of JS. This greatly limits the reusability of the front-end.
2. flexibility. In the development of the cloud structure, front-end technicians can build pages completely independently. the back-end technicians only need to provide necessary interfaces as needed.
3. scalability. Build a good front-end underlying layer, and iterate new functions to create new pages conveniently. If you are just a simple page, PHP is simple. However, there is a situation where the page content is too long and the concurrency is large.
The PHP rendering structure and ajax rendering details reflect the power. In this way, you can quickly respond to the client (with fewer server processing logic), so that users can see things faster, rather than turning around the browser.
The subsequent ajax is only data transmission. the rendering structure is still in the browser, and the server has many fewer string operations, which is definitely better than rendering on the server at a time.
Even more, you can distribute requests from each region to different business systems and do a good job of cross-origin.

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.