title: jQuery: Using .ajax() inside of .each()
body: <p>I have a list of RSS links/URLs on a page that I'm attempting to loop through using jQuery's .each functionality. Inside of that loop I am trying to use .ajax functionality to send the link to a php page that will run and then return a 1 for success or a 0 for failure. My .ajax 'success' function will use this 1 or 0 to change the color of the link on the page to green if it was successful and red if it was not.</p>
  
  <p>Below is my code which does not work. What is wrong with it?</p>
  
  <pre><code>jQuery(document).ready(function($) {
  
      $('#fetch_rss').click(
          function() {
  
              $('tr.rssrow').each(
                  function() {
  
                      var link = $('a.rsslink', this).attr('feed_link');
  
                      $.ajax({
                          url: "rss_process.php",
                          type: "POST",
                          data: {'link':link},
                          success: function(msg) {
                              if (msg &gt; 1) {
                                  $('td.link', this).addClass('green');
                              } else {
                                  $('td.link', this).addClass('green');
                              } 
  
                          },
                          fail: function(msg) {
                              $('td.link', this).addClass('orange');
                          }
                      });
  
                  } // .each callback
              ); // .each
          } // .click callback
      ); // .click
  
  });
  </code></pre>