title: I tried using this inside jquery ajax
body: <p>I realized the <code>$(this)</code> worked well outside the AJAX but not within the AJAX, can anyone help look at it to see what is wrong or what I can do?</p>
  
  <pre class="lang-js prettyprint-override"><code>$(function() {
      $(".add_friend").each(function () {
         var a=$(this).closest('div').find('#user').html();
         $.post("check_following.php", {username:a}, function(resp) {
          if (resp=='following') {
           $(this).hide();
          }     
        });
      });
  });
  </code></pre>