-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathajax.html
More file actions
35 lines (24 loc) · 758 Bytes
/
Copy pathajax.html
File metadata and controls
35 lines (24 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head><title> AJAX</title></head>
<body>
<script>
var xhr = new XMLHttpRequest();
//console.log(xhr.readyState);
//open
xhr.open('GET', 'http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Hopetoun_falls.jpg/300px-Hopetoun_falls.jpg', true);
//console.log(xhr.readyState);
xhr.setRequestHeader('User-Agent','ajax');
//xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.onreadystatechange = function(){
//console.log(xhr.readyState);
//console.log(xhr.status);
console.log(xhr.getResponseHeader('Content-Type'));
console.log(xhr.getAllResponseHeaders());
}
//console.log(xhr.readyState);
xhr.send(null);
//console.log(xhr.readyState);
</script>
</body>
</html>