First Commit

This commit is contained in:
Dita Aji Pratama 2025-06-10 10:28:59 +07:00
commit 7a497b1d4e
2 changed files with 41 additions and 0 deletions

22
index.html Normal file
View File

@ -0,0 +1,22 @@
<html>
<head>
<title>Widuri Client</title>
</head>
<body>
<table>
<tr>
<th>ID<th>
<th>Name<th>
<th>Phone<th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<script src="js/carrack.js"></script>
</body>
</html>

19
js/carrack.js Normal file
View File

@ -0,0 +1,19 @@
function sendHttpRequest(url, method, data, callback, contentType = "multipart/form-data", authorization = "") {
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.setRequestHeader("Content-Type", contentType);
xhr.setRequestHeader("Authorization", authorization);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var response = xhr.responseText;
callback(null, response);
}
else callback(xhr.status, null);
}
};
var requestData;
if (contentType === "application/json") requestData = JSON.stringify(data);
else requestData = data;
xhr.send(requestData);
}