How to return rest HTML loaded from external after empty the some ids.

How to return rest HTML loaded from external after empty the some ids.

Step one :  Get the external html file to variable

Var myurl = “externafile.html”;

$.ajax({
                url:myurl,
                dataType: "html",
               success: function(data){


}
});

externafile.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gohome.com</title>
</head>
<body>
   <div class="wrap">
                <div id="names">Nale list</div>
                <div class="span1" id="blank1">Details of the parents.</div>
                <div class="span1" id="blank2">Details of the office.</div>
    </div>
</body>
</html>












Step two : Make id=”blank1” and id=”blank2” empty

$.ajax({
                url:myurl,
                dataType: "html",
               success: function(data){


                                $(data).find(“#blank1”).html("");
                                $(data).find(“#blank2”).html("");

}
});


Step Three : Now I need to put the rest of the HTML to another variable call “finalhtml” (var = “finalhtml”;)




Final HTML should be like this
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gohome.com</title>
</head>
<body>
                <div class="wrap">
                <div id="names">Nale list</div>
                <div class="span1" id="blank1"></div>
                <div class="span2" id="blank2"></div>
    </div>
</body>
</html>













External file should not append or should not load to the browser.


Step one and two work fine but no idea how to work on step three.

Please help me to find a solution…..

    • Topic Participants

    • info