Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Ajax trabaja sobre una pagina HTML, utilizando sus elementos para
realizar acciones sobre dicha pagina.
<!DOCTYPE html>
<html>
<body>
<div id="demo">
<h2>Let AJAX change this text</h2>
<button type="button" onclick="loadDoc()">Change Content</button>
</div>
</body>
</html>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
}
¿Qué es AJAX?
AJAX es un nombre engañoso. Las aplicaciones AJAX pueden usar XML para
transportar datos, pero es igualmente común transportar datos como texto
sin formato o texto JSON.