Skip to content

Instantly share code, notes, and snippets.

@rashid327
Last active February 17, 2020 06:42
Show Gist options
  • Save rashid327/5bbf5da5010b55b6ebdc0cf8c75f56f4 to your computer and use it in GitHub Desktop.
Save rashid327/5bbf5da5010b55b6ebdc0cf8c75f56f4 to your computer and use it in GitHub Desktop.
AJAX is not a programming language. AJAX is a technique for accessing web servers from a web page. AJAX stands for Asynchronous JavaScript And XML.
<!DOCTYPE html>
<html>
<body>
<div id="demo">
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Change Content</button>
</div>
<script>
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();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment