I am fairly new to jquery promises. I would like to ask if this case is possible:
I have 2 ajax calls and I'm using .then()
to chain the two of them. This is what i would like to do:
ajaxCall1().then(ajaxCall1).done(functionCallHere);
I can use the response of ajaxCall1
in ajaxCall2
which is what I really intend to do.
However, what I want in the finality is to use both ajaxCall1
's and ajaxCall2
's responses in the functionCallHere
.
I have searched for similar questions here, and I have never found one. So.. is it possible to access the ajaxCall1
's response in the functionCallHere
? if yes, how do I do it?
Is it similar to how $.when(ajax1, ajax2).done(function(r1, r2))
work - like if you put 2 parameters in your function, it is automatically interpreted as response1 and response2?
Also, I am trying to not use .when()
here since I don't want the calls to run asynchronously or to fork them. as much as possible I just want to chain them. Of course, If it's the only way, then I can revert back to using it.
Thank you very much! :)