loop through numbered class and append shortened url
<p>I am using a bitly script to shorten urls and insert the resulits into a span tag.</p>

<p>Using jquery, how would I loop through the following list ids and replace the long url with the shortened one.</p>

<pre><code>&lt;ul class="vertical-list list-parent"&gt;
    &lt;li id="license_key_0"&gt;
      &lt;div class="primary two-quarter unit-link"&gt;
          &lt;span&gt;http://localhost:3000/projects/313f7f5586b39cd9bf7a894894564036&lt;/span&gt;
      &lt;/div&gt;
    &lt;/li&gt;
    &lt;li id="license_key_1"&gt;
    &lt;div class="primary two-quarter unit-link"&gt;
         &lt;span&gt;http://localhost:3000/projects/287a990d17b680fe410329cb95af89b9&lt;/span&gt;
   &lt;/div&gt;
  &lt;/li&gt;
&lt;li id="license_key_2"&gt;
  &lt;div class="primary two-quarter unit-link"&gt;
       &lt;span&gt;http://localhost:3000/projects/ff381cdb94070e1903c5f6fddc31b148&lt;/span&gt;
  &lt;/div&gt; 
&lt;/li&gt;
  &lt;/ul&gt;
</code></pre>

<p>The jquery:</p>

<pre><code>(function ($j) {
      function get_short_url(long_url, login, api_key, func) {
        $j.getJSON(
          "http://api.bitly.com/v3/shorten?callback=?", {
          "format": "json",
          "apiKey": api_key,
          "login": login,
          "longUrl": long_url
        },
        function (response) {
          func(response.data.url);
        });
      }

      var login = "my_login";
      var api_key = "my_api_key";
      var long_url = "m";

      get_short_url(long_url, login, api_key, function (short_url) {
        console.log(short_url);
      });

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