CodesJava

Easy learning with example program codes

ajax http response headers


Ajax refers to asynchronous java script and xml. It is not a not a programming language. Ajax is of Asynchronous type. It normally uses XML, plain text or JSON to communicate with server i.e. for data transfer.

Note: Ajax is technology independent.

getAllResponseHeaders(): method is used to get the all header information from the server response.
getResponseHeader(): method is used to get the specific header information from the server response.

Example

<!DOCTYPE html>
<html>
<body>
 
<h2> Ajax http response headers</h2>
 
<p id="test"></p>
 
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    document.getElementById("test").innerHTML =
    this.getAllResponseHeaders();
  }
};
xhttp.open("GET", "test.txt", true);
xhttp.send();
</script>
 
</body>
</html>
Posted in Ajax   
Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki