RE: What is XMLHttpRequest?

What is XMLHttpRequest?

arjun Team Leader Asked on February 12, 2017 in AJAX.
Add Comment
1 Answers

XMLHttpRequest is an API in the form of an object data whose methods transfer data between a client or web browser and a server.
It provides an easy way to get data from a URL without refreshing the web page. Send data to a web server in the background.XMLHttpRequest is mostly used in AJAX programming.

<!DOCTYPE html>



function loadXMLData(){

var xhttp = new XMLHttpRequest();

xhttp.onreadystatechange = function() {

if (this.readyState == 4 && this.status == 200) {
document.getElementById("data").innerHTML = xmlhttp.responseText;


};"GET", "sample.php", true);





<div id="data">

<button type="button" onclick="loadXMLData()">Click here to get data</button>


Team Leader Answered on February 13, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.