19 lines
644 B
HTML
19 lines
644 B
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<title>Tracer XHR Network Resource example</title>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="response-status"></div>
|
||
|
|
<div id="response-body"></div>
|
||
|
|
<script>
|
||
|
|
async function performXHR() {
|
||
|
|
const response = await window.fetch('./file.json', {method: 'POST', body: JSON.stringify({prop: 'value'})});
|
||
|
|
document.querySelector('#response-status').innerText = response.status;
|
||
|
|
const responseText = await response.text();
|
||
|
|
document.querySelector('#response-body').innerText = responseText;
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
<a onclick="javascipt:performXHR();">Download</a>
|
||
|
|
</body>
|
||
|
|
</html>
|