How does XMLHttpRequest intercept request sending and result obtaining? How to deal with it?

Alibaba cloud Q & A 2022-02-13 07:14:35 阅读数:970

xmlhttprequest intercept request sending result

Sending body Capture the request and change it before parameters body Parameters , And when the returned results are obtained, intercept and do a layer of processing , How to achieve ?

Take the answer 1:

Hello! , This example is on the premise of not polluting the existing front-end Library , Record the time taken for all asynchronous requests . List codes , For reference only , It can completely solve your problem . The core of the code is just a few lines , Most of them are used to calculate time-consuming . image.png image.png

copyright:author[Alibaba cloud Q & A],Please bring the original link to reprint, thank you.