What is the way of local refresh besides ajax

for example, on the next page of bilibili"s favorites, no xmlhttprequest is initiated (no xhr request is seen in the console), but a json string is returned to achieve the effect of local refresh. How do you do this

Jul.06,2022

Local refresh just means adding new elements to DOM , which has nothing to do with AJAX . Of course, the general meaningful operation is to get the new data, and then render the data to the user in real time through js. There are many ways to get new data. New data can be obtained by calculating existing data; or it can be read from storage supported by browsers, such as Local Storage , Session Storage , IndexedDB , etc.; it can also be obtained from the network. AJAX is just one of the technologies, and there are other technologies such as JSONP , Comet , SSE , WebSocket and so on.

as for bilibili's favorites, he got all the favorites data the first time he requested it. It is only displayed in pages when it is displayed, because the data is already in memory, so clicking on the next page does not need to request the network, it can be read directly from memory.

Menu