Looping through jquery ajax call fails if 1 of 10 loops fails
<p>I have a loop going through a json array and then firing off an ajax request. If 1 of the ajx request fails the error function is called and the success isnt. Even for the calls that were successful. If all the urls int he array work then the success function is called for each of the successful calls. </p>

<p>Why does the error get called only once and the success for each success?</p>

<pre><code> $.getJSON('/test/webcontent/js/env-urls.js', 
            function(data) {

                $.each(data.env.urls, function(index, url) {
                        //alert(url.path);
                        $.ajax({
                            url: url.path, 
                            dataType: 'jsonp',
                            jsonpCallback: 'jsonCallback',
                            cache: false,
                            success: function(data){
                                alert(data.env.v);

                                var targetreleasediv = "." + url.target + ' td:nth-child(2)';
                                var targetdescdiv = "." + url.target + ' td:nth-child(3)';

                                //alert(targetreleasediv);
                                //alert(targetdescdiv);

                                $(targetreleasediv).html(data.env.v);
                                $(targetdescdiv).html(data.env.desc);
                            },
                            error: function(jqXHR, textStatus, errorThrown){
                                alert('error');
                                var targetreleasediv = "." + url.target + ' td:nth-child(2)';
                                var targetdescdiv = "." + url.target + ' td:nth-child(3)';

                                //$(targetreleasediv).html("server is currently down");
                                //$(targetdescdiv).html("server is currently down");
                            }
                        });
                });
            });
</code></pre>

<p>Here is my json array i am looping through with the urls.</p>

<pre><code>{
   "env":{
      "urls":[
         {
            "path":"http://server:port/server/instance2.js",
            "target":"ins2-1"
         },
         {
            "path":"http://server:port/server/instance3.js",
            "target":"ins3-1"
         }
      ]
   }
}
</code></pre>
