0

$catcount 在传递时保持不变,即使它改变了它的值,url 发送相同的旧值

<script type="text/javascript">
    var $catcount=1;
    jQuery(document).ready(
        function() {

            jQuery('.scroll_container').scrollExtend(
                {   
                    'target': 'div#scroll_items',           
                    'url': 'populates.php', 
                    'newElementClass': 'list_item more_content',
        'ajaxSettings': {'data':'cid='+$catcount},
        'onSuccess':function(){
                                    jQuery('.scroll_container').scrollExtend('enable');
                                    $catcount++;
                                    alert($catcount);
                                  }     
                }
            );

        }
    );
   </script>
4

1 回答 1

1
<script type="text/javascript">
    var $catcount=1;
    jQuery(document).ready(
        function() {

            jQuery('.scroll_container').scrollExtend(
                {   
                    'target': 'div#scroll_items',           
                    'url': function() {
                             return 'populates.php?cid='+$catcount;
                     },
                    'newElementClass': 'list_item more_content',
                    'onSuccess':function(){
                                    jQuery('.scroll_container').scrollExtend('enable');
                                    $catcount++;

                     }     
                });

        }
    );
   </script>
于 2012-07-19T22:11:54.187 回答