generate jquery pop-up from ajax

generate jquery pop-up from ajax

hi

I use jquery pop-up plugin
it works perfectly on my page
but where I call this page from Ajax it doesnot works, Why?

the pop-up code
  1. $(document).ready(

  2. function(){
  3. //open popup
  4. $(document).on("click", ".pop", function(){

  5. var url = $(this).attr('name');

  6.  $("#"+url).fadeIn(1000);
  7.  positionPopup(this);
  8. });

  9. //close popup
  10. $(document).on("click", ".close", function(){

  11.   var url = $(this).attr('name');


  12. $("#"+url).fadeOut(500);
  13. });
  14. });

  15. //position the popup at the center of the page
  16. function positionPopup(element){

  17.   var url = $(element).attr('name');


  18.   if(!$("#"+url).is(':visible')){

  19.     return;
  20.   } 



  21.   $("#"+url).css({
  22.       left: ($(window).width() - $('#'+url).width()) / 2,
  23.       top: ($(window).width() - $('#'+url).width()) / 7,
  24.       position:'absolute'
  25.   });


  26. }


  27. //maintain the popup at center of the page when browser resized
  28. $(window).bind('resize',positionPopup);

  29. </script>
  30. <style>
  31. .overlay_form{
  32.     position: absolute;
  33.     border: 0px solid gray;
  34.     padding: 0px;
  35.     background: ;
  36.     width: 400px;
  37.     height: 500px;
  38. }
  39. .pop{
  40.     display: inline;
  41.     border: 0px solid gray;
  42.     width: 65px;
  43.     text-align: center;
  44.     padding: 6px;
  45.     border-radius: 5px;
  46.     text-decoration: none;
  47.     margin: 0 auto;
  48. }
  49. </style>

in my page called by ajax

  1.                 <nobr><a href='#'  id="pop" class="pop" name='<?='overlay_form'.$j?>'  ><?=get_bc_branch_name($det['branch_id'])?></a></nobr>

  2.                 <div class="overlay_form" id='<?="overlay_form".$j?>' style="display:none">

  3.                     <?
  4.                       $_GET['b_id']=$det['branch_id'];
  5.                       include('bc_branch_profile.php');
  6.                      ?>
  7.                 </div>