Why not just using ajax for Page Requests to load the page content?

后端 未结 9 972
醉话见心
醉话见心 2021-01-13 07:47

Many web pages load all of their content to change very little information.

Now I would like to know why shouldn\'t the developers just use ajax for the main page re

9条回答
  •  自闭症患者
    2021-01-13 08:27

    The whole premise really is that with AJAX you don't need to reload the whole page to update a small percentage of that webpage. This saves bandwidth and is usually much quicker than reloading the whole page.

    But if you are using AJAX to load the whole page this is in fact counterproductive. You have to write customised routines to deal with the callback of the AJAX data. Its a whole lot of extra work for little to no increase in performance.

    General rule for where to use AJAX: If your updating >50% of your page, just reload, else use AJAX.

提交回复
热议问题