AJAX中的XML解析

<div id="newdiv"> </div> <div id="createblocks"> </div> <script>
    //http://www.eugeniucozac.com/parser/parsethisxml.xml
    jQuery(document).ready(function ($) { 
        var last_category_value = "";       var xml_url = "parsethisxml.xml";
        $.ajax({
            url: xml_url,
            type: "GET",
            dataType: "xml",
            cache: false,
            success: function (msg) {
                 $(msg).find('item').each(function (id, item) {
                     var id, title, status, category, content;         
                     id = $(item).find('Id').text();
                     title = $(item).find('Title').text();
                     status = $(item).find('PublishingApproval').text();
                     category = $(item).find('Category').text(); 
                     content = $(item).find('Content').text();
                     var resulthtml = "";
                     var with_category_ = with_category();
                     var without_category_ = without_category();

                     if(category == last_category_value){
                                resulthtml = with_category_.append(without_category_);
                                category = "";
                     } else{                         
                            resulthtml =  without_category_
                            last_category_value = category;
                     }

                     var eachsection = resulthtml.appendTo("#newdiv");
                     $(eachsection).each(function() {
                         $(this).show();
                         $(this).find('.q_weblinksprite_med').text(title);
                         $(this).find(".status").text(status);
                         $(this).find('.q_rt_rowcell-1-title').text(category);
                     }); 

                });
                function with_category(){
                            var container = $("<div>").attr('id', 'q_resultslist');
                            var boxlist = $("<div>").addClass("q_boxlist");
                            var rowcell2 = $("<div>").addClass("q_rt_rowcell2");
                            var dividerwide = $("<div>").addClass("q_dividerwide");
                            var grid_20 = $("<div>").addClass("grid-20 q_padright");
                            var category_title = $("<div>").addClass("q_rt_rowcell-1-title q_reducefont");
                            var with_category = container.appendTo("#createblocks");
                                boxlist.appendTo(container);
                                rowcell2.appendTo(boxlist);
                                dividerwide.appendTo(rowcell2);
                                grid_20.appendTo(rowcell2);
                                category_title.appendTo(grid_20);
                        return with_category;       
                }

                function without_category(){
                            var rowcell2 = $("<div>").addClass("q_rt_rowcell2");
                            var grid_80 = $("<div>").addClass("grid-80 q_rt_rowcell-2 q_padleft q_add-margin-bottom");
                            var spriteindent = $("<div>").addClass("q_spriteindent-med");
                            var post_title = $("<div>").addClass("q_rt_rowcell-2-title");
                            var post_titlea = $("<a>").addClass("q_weblinksprite_med").attr("onclick", "spDialog()");
                            var prestatus = $("<div>").addClass("q_rt_rowcell-2-body q_spriteindent-lefttext");
                            var prestatus_second = $("<div>").addClass("q_rt_rowcell-2-body q_spriteindent-lefttext");
                            var clipline = $("<div>").addClass("q_clipline");
                            var readmore = $("<div>").addClass("q_readmore");
                            var readmorea = $("<a>").attr("onclick", "spDialog()");
                            var readmoreimg = $("<img>").attr("src", "/_layouts/15/images/edititem.gif?rev=23");
                            var statusem = $("<em>").text("Status:").append("<span class='status'>")
                            var without_category = grid_80.appendTo("#createblocks");
                                grid_80.appendTo(rowcell2);
                                spriteindent.appendTo(grid_80);
                                post_title.appendTo(spriteindent);
                                post_titlea.appendTo(post_title);
                                prestatus.appendTo(spriteindent);
                                prestatus.append(statusem);
                                prestatus_second.appendTo(spriteindent);
                                clipline.appendTo(prestatus_second);
                                readmore.appendTo(prestatus_second);
                                readmorea.appendTo(readmore);
                                readmoreimg.appendTo(readmorea);
                        return without_category;            
                }
            },
            error: function (msg) {
                console.log("Error");
            }
        });             
    }); </script>

Hello! to all here! I have a code, and what I want just if you see my XML I ahve 3 posts which 2 of them has the same category, what I want if the posts has the same category just to show the category only on first post. This part of code needs to work logicaly but it doesnt:

         var resulthtml = "";
             var with_category_ = with_category();
             var without_category_ = without_category();

             if(category == last_category_value){
                        resulthtml = with_category_.append(without_category_);
                        category = "";
             } else{                         
                    resulthtml =  without_category_
                    last_category_value = category;
             }

but I think i made a few mistakes, thanks!