Are parameters in multiple ajax call shared?
<p>I have the following javascript function:</p>

<pre><code>function makeAjaxCall(outerParameter1,outerParameter2,outerDivId,paramInput){
    $.ajax({
    type: "POST",
    url: "some time taking LargeWebMethod or url",   //will take some time in giving output
    data: "{param: " + paramInput+ "}",   
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: successFunction
});
    function successFunction(result){
    var innerParam1 = //some value calculated using result parameter
    var innerParam2 = //some value calculated using result parameter

    htmlString += //some large time consuming code using outerParameter1,  outerParameter2 to generate output

    htmlString += //some large value 

    $("#"+outerDivId).html(htmlString);
    }
}
</code></pre>

<p>And we have a large loop which makes multiple calls to makeAjaxCall().</p>

<pre><code>for(var i=0;i&lt;SomeLargeValue;i++){
    var outerParameter1;
    var outerParameter2;
    var id= //some div id that we want to load with some data in next ajax call
    //some code to calculate outerParameter1 and outerParameter2

    var paramToSend = //some value for paramInput parameter in makeAjaxCall()

    makeAjaxCall(outerParameter1, outerParameter2, id, paramToSend)


}
</code></pre>

<p>What I know is that parameters outerParameter1,outerParameter2, outerDivId and paramInput are available (in scope) inside successFunction() as well as makeAjaxCall().</p>

<p>innerParam1 and innerParam2 declared inside successFunction() are available only to itself and nowhere outside, not even inside makeAjaxCall().</p>

<p>Following are my doubts. I am confused about:
1.    When we make several asynchronous calls to makeAjaxCall() with different parameter values (from a large loop), different processes (successFunction() code for different calls) will be running. Will those different processes be sharing parameters outerParameter1,outerParameter2,outerDivId,paramInput.</p>

<p>What I mean to ask is "Suppose after first call to makeAjaxCall, execution of code is somewhere in between successFunction(), and another asynchrnous call to makeAjaxCall() is made with different parameter values, will the values of outerParameter1 and outerParameter2 parameters be changed for the first (previous) execution of the successFunction()?</p>

<ol start="2">
<li>Is such a code (that makes multiple ajax call with same handler) safe? Or it will lead to some problems like "dirty read"?</li>
</ol>

<p>Can someone tell me technically, what happens here? Multithreading or something else, how are stacks created etc?</p>

<p>Please help me get out of this confusion.</p>

<p>Thanks in advance!</p>