jQuery Ajax:成功响应参数覆盖 [英] jQuery Ajax: Sucess Response parameter overwriting
问题描述
我遇到一个奇怪的问题,即第一个ajax调用的响应参数被第二个调用的参数覆盖. 代码是:
I am having a strange problem where the response param of 1st ajax call is being overwritten by the 2nd call's param. Code is:
当 drawDonutForExternalLogin 和依次调用 drawDonutForExtUser ,后一个请求的响应变量(成功处理程序的数据参数)将覆盖第一个请求的数据参数.
When both drawDonutForExternalLogin & drawDonutForExtUser are called consecutively,the response variable of the later request(data param of success handler) overwrites the data param of 1st request.
调用几乎总是在同一时间完成,但是当存在差异时不会发生此问题.从第一个函数的成功处理程序调用第二个函数时,数据集也很好.
The calls do complete almost at the same time always but when there is a difference this problem doesn't occur.The data set is also fine when the 2nd function is invoked from the success handler of 1st function.
为什么在调用连续且同时完成时数据参数变得相同?
Why the data param becomes identical when the calls are consecutive and finish at the same time?
我尝试通过放置断点来调试服务器端代码,但这也提供了ajax请求之间的延迟,从而产生正确的结果.
I tried debugging the server side code by placing breakpoints but that also provides the delay between ajax requests thereby yielding correct result.
请问有什么想法吗?