Это html + ajax-код, который запрашивает другую страницу с html + css + js, но в результате в div можно загрузить только html. Мне нужна целая страница для загрузки в div,
<!DOCTYPE html>
<html>
<head>
<script>
function showHint() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
}
xmlhttp.open("GET", "AjaxTest1.html", true);
xmlhttp.send();
}
</script>
</head>
<body>
<button style="width:50px;height:50px;" onclick="showHint()">Click</button>
<div id="txtHint">
</div>
</body>
</html>
ЗапрошенныйКод страницы AjaxTest1.html:
<!DOCTYPE html>
<html>
<style>
input[type=checkbox] {
transform: scale(1.5);
}
</style>
<body id="IGG" onload="myFunction()" style="background-color:#AFF5EA">
<script>
function myFunction(){
// submisson button
var del=document.createElement("Input");
del.type="submit";
del.value="Delete";
del.style="margin-left:40%;margin-top:10%;";
document.getElementById("IGG").appendChild(del);
}
</script>
<h2>Hello this is fine</h2>
</body>
</html>
Вывод, когда я нажимаю кнопку, чтобы загрузить AjaxTest1.html
, тогда как мне нужны js и css, которые также идут вместе сhtml в responseText.