How to set values to array when async webservice responce is called
<p>Friends,</p>

<p>I have declared array in javascipt</p>

<pre><code>var Answer1 = new Array(50);
</code></pre>

<p>I want to call webserivce using $ajax &amp; i want to store its response at appropriate index of array.
&amp; want to use that array immediately after all the values are set.
Currently i am doing this by using <code>async:false</code> property of $ajax .
Does anyone know way with asynchrnous way because when i use asynchronous values of array remains undefined.</p>

<pre><code>for(var j=0;j &lt; mycollection.length-1;j++)
{
$.ajax({
                type: 'GET',
                url: webserviceURL,
                dataType: 'json',
                error: function(data)
                {
                    //alert(data.error);
                },
                success: function(data)
                {
                    if(data.error!=null)
                    {
                        console.log('data error');
                        Answer1[j] = data.name;
                    }
               },
                complete: function(data)
                {
                alert('completed:');
                },
                data: {},
                async: false
            });
</code></pre>
