I want to generate html as well as SVG code based on my Subsciber`s any of the position of on web page (or you can say any of the div).
I want to give some javascript code to be put in side of that page`s div so at that div whole my code place.
I don't want to use iframe because height and width is not defined its automated.
here what i have tried and i am still trying.
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>TODO write content</div>
<div>
<script>
(function(){
var xhr=new XMLHttpRequest();
xhr.open("get","request Url of my side",true);
xhr.send();
xhr.onreadystatechange = function(){
if(xhr.readyState==4 && xhr.status==200){
document.write(xhr.responseText);
}
};
}());
</script>
</div>
</body>
</html>
But what happening here is before response came whole page was loaded and document.write()
erase existing content and place my responseText
.
Any Help will be appreciated.