this js is at index.html between "<script type="text/javascript">"
function callanular() {
peticion_http = new XMLHttpRequest();
peticion_http.onreadystatechange = showContent;
peticion_http.open('GET', 'anular.js', true);
peticion_http.send(null);
function showContent() {
if(peticion_http.readyState == 4) {
if(peticion_http.status == 200) {
document.getElementById("notice").innerHTML=peticion_http.responseText;
}
else
document.getElementById("notice").innerHTML="ERROR "+peticion_http.status;
}
}
}
index.html HTML code I have, looking to show box on div with id=notice
<div id="notice"></div>
<input type="submit" value="RESTRICTED ACCESS" onclick="callanular()">
At the same folder I have anular.js created, I want to show a simple box with a text, in this case I only have an alert to know it's working.
window.onload = function() {
return (alert("asdasdsa"));
}
Whatever I write I can only receive the literally code. e.g.
window.onload = function() {return (alert("asdasdsa")); }