<script type="text/javascript">
        $(document).ready(function(){
            $("#Btn").click(function(){
                    $.ajax({
                        type:"get",
                url:"rss.htm",
                dataType:"html",
                beforeSend:function(){$("#show").html("数据加载中...")},
                success:function(result){
                    $("#show").html("");
                    $(result).find("table").each(function(){
                       $(this).find("td").each(function(){
                            alert($(this).text());
                       })
                    })
                }
                    });
            })
        })
    </script>这样总是获取不到td下的内容
怎么回事呢?

解决方案 »

  1.   

    先试试alert(result);看result里面是啥、
    $('table td',result).each(function(){
      alert($(this).text());
    });
      

  2.   

    $("table",result)这样难道你不会吗
      

  3.   

    <script type="text/javascript">
            $(document).ready(function(){
                $("#Btn").click(function(){
                        $.ajax({
                            type:"get",
                            url:"rss.htm",
                            dataType:"html",
                            beforeSend:function(){$("#show").html("数据加载中...")},
                            success:function(result){
                                $("#show").html("");
                                $(result).find("table").each(function(index,tableDom){
                                   $(tDom).find("td").each(function(index,tdDom){
                                        alert($(tdDom).text());
                                   })
                                })
                            }
                        });
                })
            })
        </script>