forked from thombergs/code-examples
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathindex.html
More file actions
36 lines (30 loc) · 1.09 KB
/
index.html
File metadata and controls
36 lines (30 loc) · 1.09 KB
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
36
<!DOCTYPE html>
<html>
<head>
<script>
function load(domainURL) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", domainURL, true);
xhttp.send();
}
function loadFromSameDomain() {
load("http://localhost:8001/orders")
}
function loadFromCrossDomain() {
load("http://localhost:8000/orders")
}
</script>
</head>
<body>
<div id="demo">
<h2>Order Processing</h2>
<div><button type="button" onclick="loadFromSameDomain()">Fetch Orders from same domain</button></div><br/><br/>
<div><button type="button" onclick="loadFromCrossDomain()">Fetch Orders from different domain (Cross Domain)</button></div>
</div>
</body>
</html>