$(document).ready(function() {
    doThis();
});

function doThis() {
    $.ajax({
        type: "GET",          //http请求的方式
        url: "/bbs/tools/topicslist.aspx?count=5&fid=6&length=34",  //服务器的url地址
        //data: "c=10",
        dataType: "xml",        //告诉JQuery返回的数据格式
        error: function(xml) {
            $("#topics").html("Loading...");
        },
        success: callback    //定义交互完成,并且服务器正确返回数据时调用的回调函数  
    });

    function callback(data)     //此时data不再是一个文本的数据,而是一个对象的数据  
    {
        var showcontent = "";
        $(data).find("topics").each(function(i) {
            var id = $(this).children("id").text();
            var fulltitle = $(this).children("fulltitle").text();
            var title = $(this).children("title").text();
            var isnew = $(this).children("isnew").text();
            var pic = "images/an_37.jpg";

            if (isnew == "1")
                pic = "images/an_35.jpg";

            showcontent += "<tr>"
                        + "<td width='10%' align='center' class='xx'><img src='" + pic + "' width='13' height='17'></td>"
                        + "<td width='90%' class='xx'><a href='/bbs/showtopic-" + id + ".aspx' title='" + fulltitle + "' target='_blank'>&bull; " + title + "</a></td>"
                        + "</tr>";

        });
        $("#topics").html(showcontent);
    }
}