From 7a497b1d4e150dbdbd9925248e985787948cc984 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Tue, 10 Jun 2025 10:28:59 +0700 Subject: [PATCH] First Commit --- index.html | 22 ++++++++++++++++++++++ js/carrack.js | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 index.html create mode 100644 js/carrack.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..211e693 --- /dev/null +++ b/index.html @@ -0,0 +1,22 @@ + + + Widuri Client + + + + + + + + + + + + +
ID + Name + Phone +
+ + + diff --git a/js/carrack.js b/js/carrack.js new file mode 100644 index 0000000..db11e92 --- /dev/null +++ b/js/carrack.js @@ -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); +}