I'm not sure what to do here. . . I'm trying not to ask a duplicate question, but after searching I'm still stuck.
I am using wordpress AJAX with 2 functions back to back.
The first jQuery function makes an AJAX request which generates a ul, with an a in each li.  Each anchor gets a class="ajax-link", and also gets data-value="<?php echo $var; ?>.
The anchor in the FIRST li gets class="ajax-link thefirstcn".
Immediately after this list is generated and written to the page, this function fires (there's more to it than this, but I'm shortening it):
function select_on_load() {
  var first = $(".thefirstcn").attr('data-value');
  alert(first);
}
No matter what I try, all I get is undefined when trying to fetch the information.  I've tried assigning the value to a regular "id" tag, that isn't working either. 
I'm sure it's got something to do with the fact that the element was just created, I just need to know how to go about getting it!! Thanks again
 
     
    