日期:2014-05-20  浏览次数:20758 次

类似于微博评论框加载及实现的小例子。有图有码有真相哦
分快没了。


用的是JQ。

码在这里CSDN的上传不行了今天
------解决方案--------------------

<script src="js/jquery-1.6.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function(){
            $("#div_content>a").bind("click", function(){
                var msg=$("#tb_test");
                var oobbj=$(this);//record current command obj
                if(msg.length==0){
                    //if not exit,then get ajaxHTML and append it to the current DOM
                    $.ajax({
                       type: "GET",
                       url: "handle/loadMsgClient.ashx",
                       eache: true,
                       success: function(retrevalue){
                            oobbj.after(retrevalue);
                       },
                       error: function(){
                            alert("参数出错,亲刷新后重试下^_^");
                       }
                    });                
                }
                else{
                    //if exit,then consider two aspects: appended; insertAfter current DOM
                    if(oobbj.next("#tb_test").length!=0){
                        msg.remove();
                    }
                    else{