Below is my ajax code.I have written my question as comments in the code below:
//Make the Ajax Request
$.ajax({
    type: "POST",
    url: "dbtryout2_2.php",
    data: datastr,
    success: function(arrayphp) {
         //the problem is with this album class.
         //Its not getting identified outside ajax code
         var link = $('<a href="#" class="album"><font color="red">' + arrayphp + '</font></a>');
        linkclass = link.attr("class"); 
        $(".searchby .searchlist").append(link);   
    }
});
}); 
  //On clicking element of "linkclass" The code below is not working
    $(".searchby .searchlist '.'+linkclass").on("click", function() {
 alert("iam here");
 });
 //while this code is working when i have included directly a span 
 //element "clickme" inside "searchlist division" and have given class name    "democlass" to it
 //On clicking the democlass element alert function is gettting called
     //i want alert function to be called for above code also
 $(".searchby .searchlist .democlass").on("click", function() {
 alert("iam here");
});
I want the code after ajax code to run