title: Get data attribute from elements that have been inserted to the DOM using AJAX
body: <p>I need to get the data attribute from elements that have been added to the DOM with ajax requests. What I have works perfectly with elements that were loaded in on page load but not when they are added in with ajax. I am assuming <code>.data()</code> does not work continually as a live function since in firebug the other variable got from the DOM is sent off but the data attribute is not.</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>window.setInterval(function(){
    $(".ago-time").each(function(idx) {
      var $self = $(this);
      $.get("phpscripts/get_new_time.php", {
        old_ts: $self.data("ts2"),
        index: idx
      }, function(result) {
        $self.html(result);
      });
    });
  }, 1000);
  </code></pre>
  
  <p>I have tried using the on and live attributes but that just breaks the whole thing. Theres probably something very simple that needs doing.</p>