How can I iterate with .each on this code?
<p>Still learning and need some help please.</p>

<p>This code example checks the validity of a url:</p>

<pre><code>function check_URL() {
var url = "http://" + localStorage['t'] + ".somewhere.com";

$.getJSON("http://query.yahooapis.com/v1/public/yql?"+
            "q=select%20*%20from%20html%20where%20url%3D%22"+
            encodeURIComponent(url)+
            "%22&amp;format=xml'&amp;callback=?",
    function(data){
      if(data.results[0]){
        console.log("yes");
      } 
      else { 
      console.log("no");
      alert(url + " is not a valid URL or is down.");

     }
    }
  );

};
</code></pre>

<p>It does exactly what I want (and I found it here!). But, I need to check additional urls too.</p>

<p>How can I do that with an .each? I'm just too new to this stuff and an example will help my learning.</p>

<p>Also, if it helps, the domain "somewhere" used in the example will always be the same.</p>

<p><strong>UPDATE:</strong> Thanks to Thiago who helped point me in the right direction.</p>

<pre><code>function check_URL() {

var url = "http://" + localStorage['t'] + ".somewhere.com";
var url1 = "http://" + localStorage['t1'] + ".somewhere.com";
var url2 = "http://" + localStorage['t2'] + ".somewhere.com";
var url3 = "http://" + localStorage['t3'] + ".somewhere.com";

var urlArray = ['url', 'url1', 'url2','url3'];
$(urlArray).each(function (urlItem) {
$.getJSON("http://query.yahooapis.com/v1/public/yql?"+
            "q=select%20*%20from%20html%20where%20url%3D%22"+
            encodeURIComponent(urlItem)+
            "%22&amp;format=xml'&amp;callback=?",
    function(data){
      if(data.results[0]){
        console.log("yes");
      } 
      else { 
      console.log("no");
      alert(url + " is not a valid URL or is down.");

     }
    }
  );
});
};
</code></pre>

<p>This seems to find any of the urls that don't validate but the alert is broken.</p>

<p>Ideas?</p>

<p>Thanks!</p>

<p><strong>FINAL UPDATE:</strong> Working solution posted below.</p>
