title: $(this) inside of AJAX success not working
body: <p>I am trying to change some old code which uses onclick so that I an use the $(this). The problem is that $(this) is not working when inside the success. Is there anyway to do this without setting it as a var. </p>
  
  <pre><code>$('.addToCart').click(function() {
  
      $.ajax({
          url: 'cart/update',
          type: 'post',
          data: 'product_id=' + $(this).attr("data-id"),
          dataType: 'json',
          success: function(json) {
  
              if (json['success']) {
  
              $(this).addClass("test");
  
              }   
          }
      });
  
  });
  </code></pre>