Ajax调用后的Jquery Rebind函数

1 jquery

我有个问题.在刷新div后,会触发召唤灰盒形式的单击事件.如何将该功能重新绑定到刷新的内容,其中包括将重新启动灰盒子的链接?我假设我必须在click事件后重新初始化函数.我是新手,所以请你帮忙.

    <script type="text/javascript" src="js/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="js/greybox.js"></script>
<script type="text/javascript">
      var GB_ANIMATION = true;
      $(document).ready(function(){
        $("a.greybox").click(function(){
          var t = this.title || $(this).text() || this.href;
          GB_show(t,this.href,470,600);
          return false;
        });
      });

</script>

<script type="text/javascript">  
    function update(){
      jQuery("#showdata").load("maincontentdiv.php<?php echo $passme;?>");
      }

function GB_hide2() {
  $("#GB_window,#GB_overlay").hide();
    $("#GB_window").remove();
    update();


}
Run Code Online (Sandbox Code Playgroud)

Wil*_*ill 5

jQuery中的"click"绑定和其他绑定仅在调用特定DOM元素时绑定一次.要确保还绑定动态加载的内容,请使用"实时"方法:

$("a.greybox").live('click',function(){
...
Run Code Online (Sandbox Code Playgroud)