开发者

jQuery .load() keep requesting page indefinitely

I have a checkbox where when it's clicked, .load() will be called. The requested page loads just fine except that jQuery keeps requesting page over and over again.

<script type="text/javascript">
    $(document).ready(funct开发者_运维技巧ion($) {
          $('#we').click(function() {
            $('#we_div').load('/form_url');
          });
        });
</script>
<div id="we_div" style="float:right;"><input type="checkbox" id="we"  /><label for="we">Some dummy text here.</label></div>

Can anyone tell me what's wrong with this?


@Shef gave the idea. Try this safer method

<script type="text/javascript">
    $(document).ready(function($) {
          $('#we').click(function() {
            $('#we_div').load('/form_url',function() {
               $('#chk_span').hide();
            });
          });
        });
</script>
<div style="float:right;"><div id="we_div"></div><span id="chk_span"><input type="checkbox" id="we"  /><label for="we">Some dummy text here.</label></span></div>


Perhaps /form_url also contain this script to load /form_url.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜