我两个异步请求 一个获取数据后保存在全局变量里,另一个请求使用这个做参数发送请求,但由于是异步 第一个可能没执行完成就跑第二个请求 全局变量就没被赋值
人生最曼妙的风景,竟是内心的淡定与从容!
1. Requests are in order2. Solution: A. Start a thread, use synchronous request in the thread, wait for the first data to come back, and then send the next request
B.仍然做异步,第一个请求异步响应回来后,在发下一个异步请求
In this case, you shouldn’t use asynchronous!
The first one must be synchronous, the second one can be requested asynchronously
1. Requests are in order
2. Solution: A. Start a thread, use synchronous request in the thread, wait for the first data to come back, and then send the next request
In this case, you shouldn’t use asynchronous!
The first one must be synchronous, the second one can be requested asynchronously