page.html
codice HTML:
<html>
<head>
<script>
function $ajax($params) {
var _xml_http = null;
_xml_http = new XMLHttpRequest();
_xml_http.onreadystatechange = function() {
if (_xml_http.readyState == 4 && _xml_http.status == 200) {
if ($params.success) {
$params.success(_xml_http.responseText, _xml_http.readyState);
}
}
}
_xml_http.open("GET", $params.url + "?" + _data, true);
_xml_http.send();
}
var base_url = "http://localhost";
$ajax({
url: base_url + "/load.html",
success: function(get_data, status) {
document.getElementById("page").innerHTML = get_data;
}
});
</script>
</head>
<body>
<div id="page">Vuoto</div>
</body>
</html>
load.html
codice HTML:
<script type="text/javascript">alert(1)</script>
Non capisco il motivo per cui non mi carichi lo script.